Bug#259887: gcc-3.3: Miscompiles automatic dynamic arrays
herbert@gondor.apana.org.au writes:
> Package: gcc-3.3
> Version: 1:3.3.4-3
> Severity: critical
>
> With the option -mpreferred-stack-boundary=2, gcc 3.3.4 is miscompiling
> automatic dynamic arrays. Unfortunately both are used in the
> crypto/IPsec subsystems of the Linux kernel.
I assume the complete flags are -O2 -mpreferred-stack-boundary=2 ? Can
you provide a workaround for the kernel source?
> Here is a sample program:
>
> #include <string.h>
>
> int bar(char *s);
>
> int foo(char *s, int len, int x)
> {
> char buf[x ? len : 0];
>
> if (x) {
> memcpy(buf, s, len);
> s = buf;
> }
>
> return bar(s);
> }
Reply to: