public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54038] New: finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant
@ 2012-07-19 22:23 jamborm at gcc dot gnu.org
2012-07-19 23:07 ` [Bug c++/54038] " markus at trippelsdorf dot de
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: jamborm at gcc dot gnu.org @ 2012-07-19 22:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54038
Bug #: 54038
Summary: finalize_type_size enters infinite loop becasue
TYPE_NEXT_VARIANT (variant) == variant
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jamborm@gcc.gnu.org
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu
Created attachment 27837
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27837
Delta reduced testcase
When compiling the attached testcase, which is delta-reduced from
Mozilla Firefox, gcc ends up in an endless loop at the end of
finalize_type_size in stor-layout.c because TYPE_NEXT_VARIANT
(variant) is variant itself.
This value is assigned to it in function build_cplus_array_type in
cp/tree.c (near line 811).
I compile the testcase with the following flags, no optimization is
required:
g++ -S -fpermissive -std=gnu++0x zzz.i
I'm currently on revision 189631. I'll try to do some bisecting
tomorrow.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/54038] finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant
2012-07-19 22:23 [Bug c++/54038] New: finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant jamborm at gcc dot gnu.org
@ 2012-07-19 23:07 ` markus at trippelsdorf dot de
2012-07-20 6:16 ` markus at trippelsdorf dot de
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: markus at trippelsdorf dot de @ 2012-07-19 23:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54038
Markus Trippelsdorf <markus at trippelsdorf dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |markus at trippelsdorf dot
| |de
--- Comment #1 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2012-07-19 23:06:57 UTC ---
Further reduced:
extern __const char *__const a[];
typedef char gchar;
void fn1 (const gchar * const[]);
class foo
{
static const char *const Res[];
};
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/54038] finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant
2012-07-19 22:23 [Bug c++/54038] New: finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant jamborm at gcc dot gnu.org
2012-07-19 23:07 ` [Bug c++/54038] " markus at trippelsdorf dot de
@ 2012-07-20 6:16 ` markus at trippelsdorf dot de
2012-07-20 8:55 ` [Bug c++/54038] [4.7/4.8 Regression] " rguenth at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: markus at trippelsdorf dot de @ 2012-07-20 6:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54038
Markus Trippelsdorf <markus at trippelsdorf dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #2 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2012-07-20 06:16:16 UTC ---
Started with revision 189587:
commit adf1f88f868568a3cbe7f1132c9cec4fa4dd0288
Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue Jul 17 21:34:06 2012 +0000
PR c++/53989
* tree.c (build_cplus_array_type): Also add TYPE_CANONICAL
to the list of variants.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/54038] [4.7/4.8 Regression] finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant
2012-07-19 22:23 [Bug c++/54038] New: finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant jamborm at gcc dot gnu.org
2012-07-19 23:07 ` [Bug c++/54038] " markus at trippelsdorf dot de
2012-07-20 6:16 ` markus at trippelsdorf dot de
@ 2012-07-20 8:55 ` rguenth at gcc dot gnu.org
2012-07-20 11:09 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-07-20 8:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54038
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-07-20
Known to work| |4.7.1
Blocks| |53989
Target Milestone|--- |4.7.2
Summary|finalize_type_size enters |[4.7/4.8 Regression]
|infinite loop becasue |finalize_type_size enters
|TYPE_NEXT_VARIANT (variant) |infinite loop becasue
|== variant |TYPE_NEXT_VARIANT (variant)
| |== variant
Ever Confirmed|0 |1
--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-07-20 08:55:08 UTC ---
Confirmed.
Also points to the fact that immediately installing fixes to trunk/4.7 is maybe
not a very good idea ...
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/54038] [4.7/4.8 Regression] finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant
2012-07-19 22:23 [Bug c++/54038] New: finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant jamborm at gcc dot gnu.org
` (2 preceding siblings ...)
2012-07-20 8:55 ` [Bug c++/54038] [4.7/4.8 Regression] " rguenth at gcc dot gnu.org
@ 2012-07-20 11:09 ` jakub at gcc dot gnu.org
2012-07-20 11:33 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-07-20 11:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54038
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-07-20 11:08:49 UTC ---
Created attachment 27844
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27844
gcc48-pr54038.patch
Untested fix. On array23.C testcase, we have Foo as main variant of Foo2 and
we have:
t: const Foo2 []
c: const Foo []
m: Foo []
and in that case we want to change c's TYPE_MAIN_VARIANT to m. On this new
testcase we have char as TYPE_MAIN_VARIANT of gchar, and have:
t: const gchar *const []
c: const char *const []
m: const gchar * []
and trying to change TYPE_MAIN_VARIANT of c in that case (whose
TYPE_MAIN_VARIANT is const char * [] at that point) is fatal. I believe the
important difference between the two is that in array23.C TYPE_MAIN_VARIANT
(TREE_TYPE (c)) is the same as TREE_TYPE (m) (aka TYPE_MAIN_VARIANT
(elt_type)),
but on this PR it is different and as the element type's of c vs. m + t aren't
variants of the same type, neither should the array types be variants of one
another.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/54038] [4.7/4.8 Regression] finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant
2012-07-19 22:23 [Bug c++/54038] New: finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant jamborm at gcc dot gnu.org
` (3 preceding siblings ...)
2012-07-20 11:09 ` jakub at gcc dot gnu.org
@ 2012-07-20 11:33 ` rguenth at gcc dot gnu.org
2012-07-20 11:48 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-07-20 11:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54038
--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-07-20 11:33:38 UTC ---
I doubt that it is a good idea to put TYPE_CANONICAL in type variant lists.
At most they should be the main variant itself, but in this case you can
end up merging two type variant chains. That is, the following should
hold true:
TYPE_MAIN_VARIANT (TYPE_CANONICAL (x)) == TYPE_CANONICAL (x)
so if TYPE_CANONICAL made any sense when it was introduced (in addition
to TYPE_MAIN_VARIANT) making TYPE_CANONICALs part of the variant chain
certainly shows that it didn't make sense. In conclusion it cannot be
correct to require that TYPE_CANONICAL (t) appears in the variant
chain of TYPE_MAIN_VARIANT (t) (it can be, of course still be equal
to TYPE_MAIN_VARIANT).
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/54038] [4.7/4.8 Regression] finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant
2012-07-19 22:23 [Bug c++/54038] New: finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant jamborm at gcc dot gnu.org
` (4 preceding siblings ...)
2012-07-20 11:33 ` rguenth at gcc dot gnu.org
@ 2012-07-20 11:48 ` jakub at gcc dot gnu.org
2012-07-20 16:12 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-07-20 11:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54038
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-07-20 11:48:40 UTC ---
> That is, the following should hold true:
> TYPE_MAIN_VARIANT (TYPE_CANONICAL (x)) == TYPE_CANONICAL (x)
I disagree, that is very often not the case. TYPE_CANONICAL includes in it
qualifiers, TYPE_MAIN_VARIANT has them stripped, so whenever you have some type
with any qualifiers, its TYPE_CANONICAL (either equal to the type itself or
some different type) will not be its own TYPE_MAIN_VARIANT.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/54038] [4.7/4.8 Regression] finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant
2012-07-19 22:23 [Bug c++/54038] New: finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant jamborm at gcc dot gnu.org
` (5 preceding siblings ...)
2012-07-20 11:48 ` jakub at gcc dot gnu.org
@ 2012-07-20 16:12 ` jason at gcc dot gnu.org
2012-07-20 16:12 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2012-07-20 16:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54038
--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2012-07-20 16:11:51 UTC ---
Author: jason
Date: Fri Jul 20 16:11:42 2012
New Revision: 189719
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189719
Log:
PR c++/54038
* tree.c (build_cplus_array_type): Use build_cplus_array_type to build
canonical array type rather than mess with its TYPE_*_VARIANT.
Added:
trunk/gcc/testsuite/g++.dg/other/array7.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/tree.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/54038] [4.7/4.8 Regression] finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant
2012-07-19 22:23 [Bug c++/54038] New: finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant jamborm at gcc dot gnu.org
` (6 preceding siblings ...)
2012-07-20 16:12 ` jason at gcc dot gnu.org
@ 2012-07-20 16:12 ` jason at gcc dot gnu.org
2012-07-20 16:13 ` jason at gcc dot gnu.org
2012-07-20 17:44 ` jason at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2012-07-20 16:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54038
--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2012-07-20 16:11:51 UTC ---
Author: jason
Date: Fri Jul 20 16:11:42 2012
New Revision: 189719
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189719
Log:
PR c++/54038
* tree.c (build_cplus_array_type): Use build_cplus_array_type to build
canonical array type rather than mess with its TYPE_*_VARIANT.
Added:
trunk/gcc/testsuite/g++.dg/other/array7.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/tree.c
trunk/gcc/testsuite/ChangeLog
--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2012-07-20 16:12:05 UTC ---
Author: jason
Date: Fri Jul 20 16:11:58 2012
New Revision: 189720
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189720
Log:
PR c++/54038
* tree.c (build_cplus_array_type): Use build_cplus_array_type to build
canonical array type rather than mess with its TYPE_*_VARIANT.
Added:
branches/gcc-4_7-branch/gcc/testsuite/g++.dg/other/array7.C
Modified:
branches/gcc-4_7-branch/gcc/cp/ChangeLog
branches/gcc-4_7-branch/gcc/cp/tree.c
branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/54038] [4.7/4.8 Regression] finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant
2012-07-19 22:23 [Bug c++/54038] New: finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant jamborm at gcc dot gnu.org
` (7 preceding siblings ...)
2012-07-20 16:12 ` jason at gcc dot gnu.org
@ 2012-07-20 16:13 ` jason at gcc dot gnu.org
2012-07-20 17:44 ` jason at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2012-07-20 16:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54038
--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2012-07-20 16:12:05 UTC ---
Author: jason
Date: Fri Jul 20 16:11:58 2012
New Revision: 189720
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189720
Log:
PR c++/54038
* tree.c (build_cplus_array_type): Use build_cplus_array_type to build
canonical array type rather than mess with its TYPE_*_VARIANT.
Added:
branches/gcc-4_7-branch/gcc/testsuite/g++.dg/other/array7.C
Modified:
branches/gcc-4_7-branch/gcc/cp/ChangeLog
branches/gcc-4_7-branch/gcc/cp/tree.c
branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/54038] [4.7/4.8 Regression] finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant
2012-07-19 22:23 [Bug c++/54038] New: finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant jamborm at gcc dot gnu.org
` (8 preceding siblings ...)
2012-07-20 16:13 ` jason at gcc dot gnu.org
@ 2012-07-20 17:44 ` jason at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2012-07-20 17:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54038
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2012-07-20 17:43:50 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-07-20 17:44 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-19 22:23 [Bug c++/54038] New: finalize_type_size enters infinite loop becasue TYPE_NEXT_VARIANT (variant) == variant jamborm at gcc dot gnu.org
2012-07-19 23:07 ` [Bug c++/54038] " markus at trippelsdorf dot de
2012-07-20 6:16 ` markus at trippelsdorf dot de
2012-07-20 8:55 ` [Bug c++/54038] [4.7/4.8 Regression] " rguenth at gcc dot gnu.org
2012-07-20 11:09 ` jakub at gcc dot gnu.org
2012-07-20 11:33 ` rguenth at gcc dot gnu.org
2012-07-20 11:48 ` jakub at gcc dot gnu.org
2012-07-20 16:12 ` jason at gcc dot gnu.org
2012-07-20 16:12 ` jason at gcc dot gnu.org
2012-07-20 16:13 ` jason at gcc dot gnu.org
2012-07-20 17:44 ` jason at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).