Bug 48431 - patch to fix a compile error in lto-plugin.c when using older C compilers
patch to fix a compile error in lto-plugin.c when using older C compilers
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: lto
4.6.0
: P3 normal
: 4.6.1
Assigned To: Richard Biener
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-04-04 03:52 UTC by William Bader
Modified: 2011-04-05 12:13 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-04-04 12:34:51


Attachments
patch to fix the problem (756 bytes, patch)
2011-04-04 03:52 UTC, William Bader
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description William Bader 2011-04-04 03:52:50 UTC
Created attachment 23867 [details]
patch to fix the problem

The build for gcc-4.6.0 gets a compile error on lto-plugin.c on Red Hat Linux release 7.1 (Seawolf) with gcc version 2.96 20000731 because this compiler does not allow declarations after the first statement.  The attached patch moves a declaration a few lines back.

For the build, I ran
/u/gnu/gcc-4.6.0/configure --disable-nls --enable-checking=release --enable-werror=no --with-system-zlib --disable-multilib --with-gmp=/usr/local --with-mpfr=/usr/local
make CC=gcc 'CFLAGS=-O0  -g -pipe' 'LIBCFLAGS=-O0 ' 'LIBCXXFLAGS=-O0 -fno-implicit-templates ' 'CXXFLAGS=-O0 -fno-implicit-templates ' 'CXXFLAGS_FOR_BUILD=-O0 -fno-implicit-templates ' 'CXXFLAGS_FOR_TARGET=-O0 -fno-implicit-templates ' 'GOCFLAGS_FOR_TARGET=-O0  -g -pipe' 'BOOT_CFLAGS= -O0  -g -pipe' AS=/usr/bin/as bootstrap-lean
Without all of the -O0's, the stage2 xgcc gets an ICE almost immediately on almost any input.
Comment 1 Richard Biener 2011-04-04 12:34:51 UTC
Mine.
Comment 2 Richard Biener 2011-04-05 12:11:13 UTC
Author: rguenth
Date: Tue Apr  5 12:11:08 2011
New Revision: 171982

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171982
Log:
2011-04-05  Richard Guenther  <rguenther@suse.de>

	PR bootstrap/48431
	* lto-plugin.c (claim_file_handler): Do not declare vars in code.

Modified:
    trunk/lto-plugin/ChangeLog
    trunk/lto-plugin/lto-plugin.c
Comment 3 Richard Biener 2011-04-05 12:13:31 UTC
Author: rguenth
Date: Tue Apr  5 12:13:27 2011
New Revision: 171983

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171983
Log:
2011-04-05  Richard Guenther  <rguenther@suse.de>

	PR bootstrap/48431
	* lto-plugin.c (claim_file_handler): Do not declare vars in code.

Modified:
    branches/gcc-4_6-branch/lto-plugin/ChangeLog
    branches/gcc-4_6-branch/lto-plugin/lto-plugin.c
Comment 4 Richard Biener 2011-04-05 12:13:42 UTC
Fixed.