🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Terry Jones Wed, 05 Aug 1992 20:37
bug in gcc handling of C switch cases with -O?
#268
Author: Terry Jones
Date: Wed, 05 Aug 1992 20:37
28 lines
1527 bytes
gcc 2.2.2 (at least this is the output from gcc -v) on a
SPARC 1+ with sunos 4.1.1

i don't read this newsgroup and don't have access to news right now,
so please forgive me if this is well-known and also please Cc a copy
of your reply to terry@santafe.edu


i have a piece of C code with a switch statement that switches on a
variable that is an enum type. gdb shows me that the value of the
variable is x but in the switch it goes to the case for y (there is a
case for x). this happens when i use -O and not when i don't. the
regular sun cc doesn't make the error (though i haven't tried it with
-O). 

to be more specific, the problem happens when i add -O to the
following gcc options and not without:

-g -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Waggregate-return -ggdb 

i cut my program down to a mini example to try and reproduce the
problem in a small example, but the problem went away.

before i invest more time on this, i'd like to know if it is already a
known problem. if not, i'll do something to get you a small example.

regards & thanks,
terry jones.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads