* [Bug c++/55245] Compiler segfault when compiling the small test case
2012-11-09 0:22 [Bug c++/55245] New: Compiler segfault when compiling the small test case xinliangli at gmail dot com
@ 2012-11-09 0:43 ` xinliangli at gmail dot com
2012-11-09 6:06 ` xinliangli at gmail dot com
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: xinliangli at gmail dot com @ 2012-11-09 0:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245
davidxl <xinliangli at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|4.7.3 |4.8.0
--- Comment #1 from davidxl <xinliangli at gmail dot com> 2012-11-09 00:42:55 UTC ---
The problem actually exists in main line compiler too.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/55245] Compiler segfault when compiling the small test case
2012-11-09 0:22 [Bug c++/55245] New: Compiler segfault when compiling the small test case xinliangli at gmail dot com
2012-11-09 0:43 ` [Bug c++/55245] " xinliangli at gmail dot com
@ 2012-11-09 6:06 ` xinliangli at gmail dot com
2012-11-09 9:06 ` [Bug c++/55245] [4.6/4.7/4.8 Regression] " jakub at gcc dot gnu.org
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: xinliangli at gmail dot com @ 2012-11-09 6:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245
--- Comment #2 from davidxl <xinliangli at gmail dot com> 2012-11-09 06:05:43 UTC ---
(In reply to comment #1)
> The problem actually exists in main line compiler too.
This is another test case.
Segfaults without option, but builds ok with -DOK.
The problem seems to be that the main variant of the array type
Vector2<float>[2] does not have size, while the variant Vector2_f[2] has. The
variant's size later gets reset to 0 (from main variant).
David
template <typename VType> class Vector2 {
public:
Vector2();
VType x() const;
};
typedef Vector2<float> Vector2_f;
void GetR(const Vector2_f mosaic_position[3]);
template <class C> struct DefaultDeleter {
float GetColorTexCoord(Vector2_f &tex_coord) const {
return tex_coord.x();
}
};
class GetT { private: virtual void TestBody(); };
void GetT::TestBody() {
#ifdef OK
Vector2<float> mosaic_position[2][3] = { };
#else
Vector2_f mosaic_position[2][3] = { };
#endif
}
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/55245] [4.6/4.7/4.8 Regression] Compiler segfault when compiling the small test case
2012-11-09 0:22 [Bug c++/55245] New: Compiler segfault when compiling the small test case xinliangli at gmail dot com
2012-11-09 0:43 ` [Bug c++/55245] " xinliangli at gmail dot com
2012-11-09 6:06 ` xinliangli at gmail dot com
@ 2012-11-09 9:06 ` jakub at gcc dot gnu.org
2012-11-21 0:53 ` [Bug c++/55245] [4.6/4.7/4.8 Regression] Compiler segfault when compiling a " dnovillo at gcc dot gnu.org
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-09 9:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-11-09
CC| |jakub at gcc dot gnu.org
Target Milestone|--- |4.6.4
Summary|Compiler segfault when |[4.6/4.7/4.8 Regression]
|compiling the small test |Compiler segfault when
|case |compiling the small test
| |case
Ever Confirmed|0 |1
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-09 09:06:25 UTC ---
Started with http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170853 aka
PR48029 fix.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/55245] [4.6/4.7/4.8 Regression] Compiler segfault when compiling a small test case
2012-11-09 0:22 [Bug c++/55245] New: Compiler segfault when compiling the small test case xinliangli at gmail dot com
` (2 preceding siblings ...)
2012-11-09 9:06 ` [Bug c++/55245] [4.6/4.7/4.8 Regression] " jakub at gcc dot gnu.org
@ 2012-11-21 0:53 ` dnovillo at gcc dot gnu.org
2012-11-21 16:17 ` xinliangli at gmail dot com
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: dnovillo at gcc dot gnu.org @ 2012-11-21 0:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245
Diego Novillo <dnovillo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dnovillo at gcc dot gnu.org
--- Comment #4 from Diego Novillo <dnovillo at gcc dot gnu.org> 2012-11-21 00:52:57 UTC ---
David's analysis is correct. The type of the element at the point of the
failure is not a complete type.
At this point, I think all the types should've been completed, so I'm not sure
why this one still isn't. Jason, this patchlet (which is very likely papering
over the issue) allows the file to build.
Index: gimplify.c
===================================================================
--- gimplify.c (revision 193508)
+++ gimplify.c (working copy)
@@ -2123,6 +2123,8 @@
if (TREE_OPERAND (t, 3) == NULL_TREE)
{
tree elmt_type = TREE_TYPE (TREE_TYPE (TREE_OPERAND (t, 0)));
+ if (!COMPLETE_TYPE_P (elmt_type))
+ layout_type (elmt_type);
tree elmt_size = unshare_expr (array_ref_element_size (t));
tree factor = size_int (TYPE_ALIGN_UNIT (elmt_type));
In this case, we have
t ==> mosaic_position[tri]
elmt_type ==> struct Vector2_f[3], but we cannot compute its element size
because it has not yet been laid out.
Jason, what would be a better place to make sure the type is laid out?
Thanks. Diego.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/55245] [4.6/4.7/4.8 Regression] Compiler segfault when compiling a small test case
2012-11-09 0:22 [Bug c++/55245] New: Compiler segfault when compiling the small test case xinliangli at gmail dot com
` (3 preceding siblings ...)
2012-11-21 0:53 ` [Bug c++/55245] [4.6/4.7/4.8 Regression] Compiler segfault when compiling a " dnovillo at gcc dot gnu.org
@ 2012-11-21 16:17 ` xinliangli at gmail dot com
2012-11-26 9:49 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: xinliangli at gmail dot com @ 2012-11-21 16:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245
--- Comment #5 from davidxl <xinliangli at gmail dot com> 2012-11-21 16:17:27 UTC ---
Should the main variant types gets laid out in gimplify_type_sizes, when the
variant's type has size, but the main variant is incomplete?
David
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/55245] [4.6/4.7/4.8 Regression] Compiler segfault when compiling a small test case
2012-11-09 0:22 [Bug c++/55245] New: Compiler segfault when compiling the small test case xinliangli at gmail dot com
` (4 preceding siblings ...)
2012-11-21 16:17 ` xinliangli at gmail dot com
@ 2012-11-26 9:49 ` jakub at gcc dot gnu.org
2012-11-26 18:36 ` dnovillo at gcc dot gnu.org
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-26 9:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-26 09:49:23 UTC ---
I'd say it should be the FE's responsibility to layout all needed types, so it
should be done either somewhere when the type ARRAY_REF is created or
finalized, or in cp-gimplify.c at latest.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/55245] [4.6/4.7/4.8 Regression] Compiler segfault when compiling a small test case
2012-11-09 0:22 [Bug c++/55245] New: Compiler segfault when compiling the small test case xinliangli at gmail dot com
` (5 preceding siblings ...)
2012-11-26 9:49 ` jakub at gcc dot gnu.org
@ 2012-11-26 18:36 ` dnovillo at gcc dot gnu.org
2012-12-06 16:11 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: dnovillo at gcc dot gnu.org @ 2012-11-26 18:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245
--- Comment #7 from Diego Novillo <dnovillo at gcc dot gnu.org> 2012-11-26 18:35:43 UTC ---
Author: dnovillo
Date: Mon Nov 26 18:35:38 2012
New Revision: 193825
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193825
Log:
Google ref b/7500842.
2012-11-26 Diego Novillo <dnovillo@google.com>
* gimplify.c: Work around for PR 55245.
testsuite/ChangeLog.google-integration
* g++.dg/pr55245.C: New.
Added:
branches/google/gcc-4_7/gcc/testsuite/g++.dg/pr55245.C
Modified:
branches/google/gcc-4_7/gcc/ChangeLog.google-4_7
branches/google/gcc-4_7/gcc/gimplify.c
branches/google/gcc-4_7/gcc/testsuite/ChangeLog.google-4_7
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/55245] [4.6/4.7/4.8 Regression] Compiler segfault when compiling a small test case
2012-11-09 0:22 [Bug c++/55245] New: Compiler segfault when compiling the small test case xinliangli at gmail dot com
` (6 preceding siblings ...)
2012-11-26 18:36 ` dnovillo at gcc dot gnu.org
@ 2012-12-06 16:11 ` rguenth at gcc dot gnu.org
2012-12-06 22:18 ` [Bug c++/55245] [4.6 " jason at gcc dot gnu.org
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-06 16:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Priority|P3 |P2
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/55245] [4.6 Regression] Compiler segfault when compiling a small test case
2012-11-09 0:22 [Bug c++/55245] New: Compiler segfault when compiling the small test case xinliangli at gmail dot com
` (7 preceding siblings ...)
2012-12-06 16:11 ` rguenth at gcc dot gnu.org
@ 2012-12-06 22:18 ` jason at gcc dot gnu.org
2012-12-07 4:55 ` jason at gcc dot gnu.org
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2012-12-06 22:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
Summary|[4.6/4.7/4.8 Regression] |[4.6 Regression] Compiler
|Compiler segfault when |segfault when compiling a
|compiling a small test case |small test case
--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2012-12-06 22:18:18 UTC ---
Fixed for 4.7 and 4.8 by patch for bug 55032.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/55245] [4.6 Regression] Compiler segfault when compiling a small test case
2012-11-09 0:22 [Bug c++/55245] New: Compiler segfault when compiling the small test case xinliangli at gmail dot com
` (8 preceding siblings ...)
2012-12-06 22:18 ` [Bug c++/55245] [4.6 " jason at gcc dot gnu.org
@ 2012-12-07 4:55 ` jason at gcc dot gnu.org
2012-12-07 5:15 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2012-12-07 4:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245
--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2012-12-07 04:54:23 UTC ---
Author: jason
Date: Fri Dec 7 04:54:12 2012
New Revision: 194283
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194283
Log:
add PR 55245 marker
Modified:
trunk/gcc/ChangeLog
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/55245] [4.6 Regression] Compiler segfault when compiling a small test case
2012-11-09 0:22 [Bug c++/55245] New: Compiler segfault when compiling the small test case xinliangli at gmail dot com
` (9 preceding siblings ...)
2012-12-07 4:55 ` jason at gcc dot gnu.org
@ 2012-12-07 5:15 ` jason at gcc dot gnu.org
2013-01-02 19:04 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2012-12-07 5:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> 2012-12-07 05:14:34 UTC ---
Fix applied for 4.6.4 as well.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/55245] [4.6 Regression] Compiler segfault when compiling a small test case
2012-11-09 0:22 [Bug c++/55245] New: Compiler segfault when compiling the small test case xinliangli at gmail dot com
` (10 preceding siblings ...)
2012-12-07 5:15 ` jason at gcc dot gnu.org
@ 2013-01-02 19:04 ` jason at gcc dot gnu.org
2013-01-02 19:05 ` jason at gcc dot gnu.org
2013-01-02 19:05 ` jason at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2013-01-02 19:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245
--- Comment #11 from Jason Merrill <jason at gcc dot gnu.org> 2013-01-02 19:03:17 UTC ---
Author: jason
Date: Wed Jan 2 19:03:04 2013
New Revision: 194811
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194811
Log:
PR c++/55804
PR c++/55032
PR c++/55245
* tree.c (build_array_type_1): Revert earlier change.
* cp/tree.c (build_cplus_array_type): Copy layout information
to main variant if necessary.
Added:
trunk/gcc/testsuite/g++.dg/init/array33.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/tree.c
trunk/gcc/tree.c
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/55245] [4.6 Regression] Compiler segfault when compiling a small test case
2012-11-09 0:22 [Bug c++/55245] New: Compiler segfault when compiling the small test case xinliangli at gmail dot com
` (11 preceding siblings ...)
2013-01-02 19:04 ` jason at gcc dot gnu.org
@ 2013-01-02 19:05 ` jason at gcc dot gnu.org
2013-01-02 19:05 ` jason at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2013-01-02 19:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245
--- Comment #12 from Jason Merrill <jason at gcc dot gnu.org> 2013-01-02 19:03:55 UTC ---
Author: jason
Date: Wed Jan 2 19:03:37 2013
New Revision: 194812
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194812
Log:
PR c++/55804
PR c++/55032
PR c++/55245
* tree.c (build_array_type_1): Revert earlier change.
* cp/tree.c (build_cplus_array_type): Copy layout information
to main variant if necessary.
Added:
branches/gcc-4_7-branch/gcc/testsuite/g++.dg/init/array33.C
Modified:
branches/gcc-4_7-branch/gcc/ChangeLog
branches/gcc-4_7-branch/gcc/cp/ChangeLog
branches/gcc-4_7-branch/gcc/cp/tree.c
branches/gcc-4_7-branch/gcc/tree.c
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/55245] [4.6 Regression] Compiler segfault when compiling a small test case
2012-11-09 0:22 [Bug c++/55245] New: Compiler segfault when compiling the small test case xinliangli at gmail dot com
` (12 preceding siblings ...)
2013-01-02 19:05 ` jason at gcc dot gnu.org
@ 2013-01-02 19:05 ` jason at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2013-01-02 19:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245
--- Comment #13 from Jason Merrill <jason at gcc dot gnu.org> 2013-01-02 19:04:07 UTC ---
Author: jason
Date: Wed Jan 2 19:03:46 2013
New Revision: 194813
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194813
Log:
PR c++/55804
PR c++/55032
PR c++/55245
* tree.c (build_array_type_1): Revert earlier change.
* cp/tree.c (build_cplus_array_type): Copy layout information
to main variant if necessary.
Added:
branches/gcc-4_6-branch/gcc/testsuite/g++.dg/init/array33.C
Modified:
branches/gcc-4_6-branch/gcc/ChangeLog
branches/gcc-4_6-branch/gcc/cp/ChangeLog
branches/gcc-4_6-branch/gcc/cp/tree.c
branches/gcc-4_6-branch/gcc/tree.c
^ permalink raw reply [flat|nested] 15+ messages in thread