[Vm-dev] FloatMathPlugin crashes the VM if compiled with gcc optimization

Igor Stasenko siguctua at gmail.com
Sun Dec 26 19:40:36 UTC 2010


On 26 December 2010 20:23, David T. Lewis <lewis at mail.msen.com> wrote:
> VM builders:
> Recent updates in Squeak trunk expose an issue with the FloatMathPlugin.
> This plugin should be built with compiler optimization turned off,
> otherwise the plugin can crash the VM.
> The Mantis report is at http://bugs.squeak.org/view.php?id=7592
> and the discussion on squeak-dev is at
> http://lists.squeakfoundation.org/pipermail/squeak-dev/2010-December/156132.html
> Although this has not been verified on all platforms, the working
> assumption should be that optimization must be turned off for
> FloatMathPlugin when using gcc.

Yep.. i noticed that when extracting the knowledge from makefiles and
putting it into ST code:

configureFloatMathPlugin: maker
	"extra rules for FloatMathPlugin"

	maker addCrossSources: #(
		'acos.c' 'acosh.c' 'asin.c' 'asinh.c' 'atan.c' 'atan2.c' 'atanh.c'
		'copysign.c' 'cos.c' 'cosh.c' 'exp.c' 'expm1.c' 'finite.c' 'fmod.c'
		'hypot.c' 'isnan.c' 'k_cos.c' 'k_rem_pio2.c' 'k_sin.c' 'k_tan.c' 'ldexp.c'
		'log.c' 'log10.c' 'log1p.c' 'modf.c' 'pow.c' 'rem_pio2.c' 'rint.c'
		'scalb.c' 'scalbn.c' 'sin.c' 'sinh.c' 'sqrt.c' 'tan.c' 'tanh.c' ).

	"On windoze, lib should be built without optimizations?
	On *nix & mac with -DNO_ISNAN "
	maker puts:'
if (${WIN32})
	add_definitions(-Werror-implicit-function-declaration -O0)	
endif (${WIN32})'.

Note, that on unix and mac it defines -DNO_ISNAN
while on win32, it compiles with -O0 flag, which turns off all optimizations.

It would be good to know why optimization(s) causing crash, and how we
could fix that in code,
 because i'm not in favor having VM  which stability depends on
compiler peculiarities.

> Dave

Best regards,
Igor Stasenko AKA sig.

More information about the Vm-dev mailing list