https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66373
Bug ID: 66373 Summary: gcc downloaded from Fedora 21 repository produces defective executable. Same source code with gcc from Fedora 19 and Fedora 20 works fine Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: juanslayton at dslextreme dot com Target Milestone: --- Created attachment 35675 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35675&action=edit source code and 3 compilations from different gcc versions In the attached files, xs.c is the source file for a program that polls 40 USB keyboards (the “student keyboards”) and does various things with any input that it finds. Files a, b, and c are executable files produced by 3 different editions of gcc downloaded from Fedora repositories. Each was compiled with “gcc -Wall -Wextra -lSDL2 -lrt -lSDL2_ttf -O3 xs.c”. Each compilation was clean, with no errors or warnings. Files a and b work beautifully. File c misbehaves in such a way as to render the program unusable. Under the circumstances, suspicion falls on the latest edition of gcc as downloaded from the Fedora 21 repository. Here are the specifics. File a was compiled with Fedora 19, gcc version 4.8.2 20131212 (Red Hat 4.8.2-7) File b was compiled with Fedora 20, gcc version 4.8.3 20140911 (Red Hat 4.8.3-7) File c was compiled with Fedora 21, gcc version 4.9.2 20150212 (Red Hat 4.9.2-6) The failure seems to be on a return from subroutine get_event, lines 2919ff, of xp.c This subroutine is called to read keystrokes from student boards and return them to the calling routines. There are 7 such routines; four present math facts drills, one gives keyboarding practice, one gives advice on written work from a textbook, and one is a rudimentary word processor. They process returns from get_event in various ways, but the run time error is the same for each of them, which points to get_event as the error location. This is not a sure thing, and it could be that whatever the error is, it could be duplicated in each of the 7 calling routines. The error is this, when get_event returns 10, (ie, ‘enter’ has been pushed) the program jumps to the primary program menu, rather than continuing the routine that called get_event. Whether it does this by going through that routine, or by somehow going around it, I haven’t yet determined. But the fact that only compilations under the latest gcc edition show this behavior, suggests a bug in the compiler. I can’t imagine what it would be.