13382 – [3.3/3.4 Regression] Type information for const pointer disappears during optimisation. (original) (raw)

Description richard.hutchinson 2003-12-11 13:00:13 UTC

Compiling the source code

static const struct { int aMember; } *const aPointer = 0;

int main() { int anInt = (aPointer == 0) ? 0 : aPointer->aMember; return 0; }

with the command line

gcc -o prog -O prog.c

generates the following error output:

testgcc.c: In function main': testgcc.c:15: error: request for member aMember' in something not a structure or union

This does not happen if the -O switch is omitted.

This behaviour does not occur with gcc 2.95.3 (the only other Solaris version I have to hand).

Comment 1 Dara Hazeghi 2003-12-11 15:24:25 UTC

Confirmed with 3.3 branch and mainline. This is indeed a regression since 2.95.3. It does however fail with 3.0.4 and newer, so it's not a very new one.

Comment 2 Drea Pinski 2003-12-11 18:28:53 UTC

Fold is folding something but not keeping the type around.

Comment 3 Eric Botcazou 2003-12-20 12:50:21 UTC

Fixing.