Bug 51969 - [4.6 regression] trunk gcc unable to build gcc 4.6
Summary: [4.6 regression] trunk gcc unable to build gcc 4.6
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.6.3
: P3 normal
Target Milestone: 4.6.3
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 52986 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-01-23 16:53 UTC by Markus Trippelsdorf
Modified: 2012-06-11 09:10 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-01-23 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Trippelsdorf 2012-01-23 16:53:22 UTC
gcc-4.7 doesn't build gcc-4.6 anymore:

gtype-desc.c:8893:18: error: subscripted value is neither array nor pointer nor vector
gtype-desc.c:9012:36: error: subscripted value is neither array nor pointer nor vector
gtype-desc.c:9096:31: error: subscripted value is neither array nor pointer nor vector
gtype-desc.c:9117:31: error: subscripted value is neither array nor pointer nor vector
gtype-desc.c:9124:31: error: subscripted value is neither array nor pointer nor vector
gtype-desc.c:9131:31: error: subscripted value is neither array nor pointer nor vector
make[3]: *** [gtype-desc.o] Error 1
make[3]: *** Waiting for unfinished jobs....

or with --enable-build-with-cxx:

gtype-desc.c:8893:20: error: no match for ‘operator[]’ in ‘x_rtl[0]’
gtype-desc.c:9012:38: error: no match for ‘operator[]’ in ‘default_target_libfuncs[0]’
gtype-desc.c:9096:33: error: no match for ‘operator[]’ in ‘default_target_rtl[0]’
gtype-desc.c:9117:33: error: no match for ‘operator[]’ in ‘default_target_rtl[0]’
gtype-desc.c:9124:33: error: no match for ‘operator[]’ in ‘default_target_rtl[0]’
gtype-desc.c:9131:33: error: no match for ‘operator[]’ in ‘default_target_rtl[0]’
make[3]: *** [gtype-desc.o] Error 1
make[3]: *** Waiting for unfinished jobs....

(gcc-4.6.3 builds gcc-4.6 without problems.)
Comment 1 Markus Trippelsdorf 2012-01-23 18:21:14 UTC
The following patch (applied to 4.6) fixes the problem for me:

diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index abf17f8..550d3bb 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -3594,13 +3594,13 @@ write_field_root (outf_p f, pair_p v, type_p type, const char *name,
                  int has_length, struct fileloc *line, const char *if_marked,
                  bool emit_pch, type_p field_type, const char *field_name)
 {
+  struct pair newv;
   /* If the field reference is relative to V, rather than to some
      subcomponent of V, we can mark any subarrays with a single stride.
      We're effectively treating the field as a global variable in its
      own right.  */
   if (v && type == v->type)
     {
-      struct pair newv;
 
       newv = *v;
       newv.type = field_type;
Comment 2 Jakub Jelinek 2012-01-23 18:33:58 UTC
Yeah,
2011-11-08  Michael Matz  <matz@suse.de>

        * gengtype.c (write_field_root): Avoid out-of-scope access of newv.
should be backported to 4.6.
Comment 3 Ralf Corsepius 2012-01-24 07:05:03 UTC
Thanks, Markus, Jakub.

Despite I don't understand this patch, it patch seems to work for me :)
Comment 4 Richard Biener 2012-01-24 13:03:42 UTC
Confirmed, I've seen this as well.
Comment 5 Jakub Jelinek 2012-02-14 23:31:46 UTC
Author: jakub
Date: Tue Feb 14 23:31:42 2012
New Revision: 184239

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184239
Log:
	PR bootstrap/51969
	Backported from mainline
	2011-11-08  Michael Matz  <matz@suse.de>

	* gengtype.c (write_field_root): Avoid out-of-scope access of newv.

Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/gengtype.c
Comment 6 Jakub Jelinek 2012-02-14 23:45:23 UTC
Fixed.
Comment 7 Andrew Pinski 2012-04-24 04:22:19 UTC
*** Bug 52986 has been marked as a duplicate of this bug. ***
Comment 8 jye2 2012-06-11 09:10:17 UTC
Author: jye2
Date: Mon Jun 11 09:10:07 2012
New Revision: 188381

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188381
Log:
2012-06-11  Joey Ye  <joey.ye@arm.com>

	Backport r184089,184180 from mainline
	2012-02-10  Jan Hubicka  <jh@suse.cz>

	PR middle-end/48600
	* predict.c (predict_paths_for_bb): Prevent looping.
	(predict_paths_leading_to_edge, predict_paths_leading_to): Update.

	2012-02-13  Jan Hubicka  <jh@suse.cz>

	PR middle-end/52214
	* predict.c (predict_paths_for_bb): Fix thinko in prevoius patch.


	Backport partly r181172 from mainline
	2011-11-08  Michael Matz  <matz@suse.de>

	PR bootstrap/51969
	* gengtype.c (write_field_root): Avoid out-of-scope access of newv.

testsuite:

	Backport r184089 from mainline
	2012-02-10  Jan Hubicka  <jh@suse.cz>

	PR middle-end/48600
	* g++.dg/torture/pr48600.C: New testcase.

Added:
    branches/ARM/embedded-4_6-branch/gcc/testsuite/c-c++-common/pr52181.c
    branches/ARM/embedded-4_6-branch/gcc/testsuite/g++.dg/torture/pr48600.C
Modified:
    branches/ARM/embedded-4_6-branch/gcc/ChangeLog.arm
    branches/ARM/embedded-4_6-branch/gcc/gengtype.c
    branches/ARM/embedded-4_6-branch/gcc/predict.c
    branches/ARM/embedded-4_6-branch/gcc/testsuite/ChangeLog.arm