The compiler is not listed on bugs.opensolaris.org because it's not part
of the OpenSolaris project, but a product in it's own right.   The
tools-compilers mailing list is probably the best place at OpenSolaris to
discuss the issue - I believe bug reports for the compiler can be submitted
somewhere on http://developer.sun.com/

        -Alan Coopersmith-           alan.coopersmith at sun.com
         Sun Microsystems, Inc. - X Window System Engineering

Andy Armstrong wrote:
> (I hope this is the right place for the report - I couldn't find the  
> compiler listed as a component on the bug tracker. If not please point  
> me in the right direction)
> 
> The Perl module Crypt::Rijndael 1.05 was failing on
> 
> $ uname -a
> SunOS solaris-devx 5.11 snv_68 i86pc i386 i86pc Solaris
> $ cc -V
> cc: Sun C 5.9 SunOS_i386 2007/05/03
> 
> It turns out to be a compiler bug. This program demonstrates it:
> 
>      /* cc-bug.c */
>      #include <stdio.h>
> 
>      static unsigned char x;
> 
>      void init(void) {
>          x = 0xFF;
>      }
> 
>      int main(void) {
>          int flag;
>          init();
>          x++;
>          flag = x ? 1 : 0;
>          printf("%d %d\n", flag, x);
>          return 0;
>      }
> 
> When built with -O3 it gets the implicit test of x wrong:
> 
> $ cc -O3 -o cc-bug cc-bug.c
> $ ./cc-bug
> 1 0
> 
> I guess it increments x to 0x100 in a word sized register and then  
> forgets to truncate it before doing the test on its value.
> 



Reply via email to