[BUG][FIX][VM] JPEGReadWriter2Plugin not loading under certain
compiler optimizations conditions
John M McIntosh
johnmci at smalltalkconsulting.com
Fri Dec 26 07:39:10 UTC 2003
The usage of Apple GCC compiler option -fast in the Mac VM 3.7.x VM
has pointed out a compiler optimization issue that uncovers a bug in
JPEGReadWriter2Plugin, Masahiro Sakai <masa at micronet-japan.jp> was kind
enough to send me email about the issue.
JPEGReaderWriter2Plugin has
JPEGReaderWriter2Plugin>>initialiseModule
self export: true
which translates to
EXPORT(int) initialiseModule(void) {
}
You will note the absence of a return value, this routine *is expected*
to return true or false, the compiler when testing returns a value
which is > 0 and we are happy, although I'm not sure why it does that
or even if it does, perhaps it decided the routine doesn't exist?
Certainly it gives a warning about a missing return value which we
ignore, isn't C fun... Hah, a typed language...
However when the optimizer is turned on, then at a certain feature
level it notices no return value and ensures the value is 0, versus say
a random non-zero. Well it doesn't matter if you expect a value back,
and don't give a value, then who knows???
Certainly compiler issues are fun to debug and this as a side effect
causes the initialization of the JPEGReaderWriter2Plugin plugin to
fail, and we fall back to the old Smalltalk code for JPEGS which does
not understand progressive jpegs. Of course I'm quite curious about
what compilers do on other platforms with this code gem.
PS attached is a change set to add return true to the initialize and
release module methods in JPEGReaderWriter2Plugin
--
========================================================================
===
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
========================================================================
===
-------------- next part --------------
A non-text attachment was scrubbed...
Name: JPEGReaderWriter2ProperInit.1.cs.gz
Type: application/x-gzip
Size: 421 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20031225/a13ed5fb/JPEGReaderWriter2ProperInit.1.cs.bin
More information about the Squeak-dev
mailing list
|