This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/16223] New: Optimiser bug in gcc-3.4.0 (also in 3.4.1 20040625 prerelease)


*  the exact version of GCC; 

	gcc-3.4.0 downloaded from GNU ftp site.
	Same symptom also present in gcc version 3.4.1 20040625.

* the system type;

	Native i686-pc-linux-gnu

* the options given when GCC was configured/built;

   ../src/configure -v --enable-languages=c --prefix=/home/erikd/Local
--program-prefix=test-3.4.0-

* the complete command line that triggers the bug;

    test-3.4.0-gcc -v -save-temps -g -O2 -W -Wall -Werror term_test.c -lm -o
term_test-3.4

* the compiler output (error messages, warnings, etc.); and

	Reading specs from /home/erikd/Local/lib/gcc/i686-pc-linux-gnu/3.4.0/specs
	Configured with: ../src/configure -v --enable-languages=c
--prefix=/home/erikd/Local --program-prefix=test- : (reconfigured)
../src/configure -v --enable-languages=c --prefix=/home/erikd/Local
--program-prefix=test-3.4.0-
	Thread model: posix
	gcc version 3.4.0
	 /home/erikd/Local/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1 -E -quiet -v
term_test.c -mtune=pentiumpro -W -Wall -Werror -fworking-directory -O2 -o
term_test.i
	ignoring nonexistent directory
"/home/erikd/Local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../i686-pc-linux-gnu/include"
	#include "..." search starts here:
	#include <...> search starts here:
	 /usr/local/include
	 /home/erikd/Local/include
	 /home/erikd/Local/lib/gcc/i686-pc-linux-gnu/3.4.0/include
	 /usr/include
	End of search list.
	 /home/erikd/Local/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1 -fpreprocessed
term_test.i -quiet -dumpbase term_test.c -mtune=pentiumpro -auxbase term_test -g
-O2 -W -Wall -Werror -version -o term_test.s
	GNU C version 3.4.0 (i686-pc-linux-gnu)
	        compiled by GNU C version 3.3.4 (Debian).
	GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
	 as --traditional-format -V -Qy -o term_test.o term_test.s
	GNU assembler version 2.14.90.0.7 (i386-linux) using BFD version 2.14.90.0.7
20031029 Debian GNU/Linux
	 /home/erikd/Local/libexec/gcc/i686-pc-linux-gnu/3.4.0/collect2 --eh-frame-hdr
-m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o term_test-3.4 /usr/lib/crt1.o
/usr/lib/crti.o /home/erikd/Local/lib/gcc/i686-pc-linux-gnu/3.4.0/crtbegin.o
-L/home/erikd/Local/lib/gcc/i686-pc-linux-gnu/3.4.0
-L/home/erikd/Local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../.. term_test.o -lm
-lgcc -lgcc_eh -lc -lgcc -lgcc_eh
/home/erikd/Local/lib/gcc/i686-pc-linux-gnu/3.4.0/crtend.o /usr/lib/crtn.o
	
* the preprocessed file (*.i*) that triggers the bug, generated by adding
-save-temps to the 
  complete compilation command, or, in the case of a bug report for the GNAT
front end, a 
  complete set of source files (see below).

    Will attempt to attach the pre-processor output to the bug.

Bug Description
---------------

The code is a stripped down version of a test case which is part of the test
suite for a library I am the author of. In successful completion, the program 
should print out:

  term_test : pass
  term_test : pass

and when it fails it prints out:

  term_test : 

Line 152 : Bad output frame count.

        terminate             : 10
        src_ratio             : 0.1000
        input_len             : 1848
        input_len * src_ratio : 184.800000
        output_frames_gen     : 214


The code passes for gcc-3.3 and earlier, but fails when compiled with gcc-3.4.
The compiler produces no warnings or errors when generating the executable that
fails.

I have looked at the docs here:

   http://gcc.gnu.org/gcc-3.4/changes.html

which suggests using the -fno-unit-at-a-time switch. This fixes the problem, 
but I don't think this compiler switch should be necessary because my code:

   0) doesn't use any assembler
   1) doesn't have any unreferenced static data
   2) has only one static (inline) function which is only called from C

-- 
           Summary: Optimiser bug in gcc-3.4.0 (also in 3.4.1 20040625
                    prerelease)
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc-erikd at mega-nerd dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16223


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]