public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53605] New: Compiler ICEs in size_binop_loc
@ 2012-06-07 17:34 xinliangli at gmail dot com
  2012-06-07 20:10 ` [Bug c++/53605] [4.7/4.8 Regression] " hjl.tools at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: xinliangli at gmail dot com @ 2012-06-07 17:34 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53605
           Summary: Compiler ICEs in size_binop_loc
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: xinliangli@gmail.com


Compile the small program with gcc (trunk or 4-7 compiler), the compiler will
ICE.


template <bool lhs_is_null_literal>
class EqHelper {
 public:
  template <typename T1, typename T2>
  static int  Compare( const T1& expected,
                         const T2& actual);
};
void foo(){
  static const int kData[] = {};
     ::EqHelper<false>::Compare(kData, "abc");
}

This is a regression from gcc4_6.

David


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/53605] [4.7/4.8 Regression] Compiler ICEs in size_binop_loc
  2012-06-07 17:34 [Bug c++/53605] New: Compiler ICEs in size_binop_loc xinliangli at gmail dot com
@ 2012-06-07 20:10 ` hjl.tools at gmail dot com
  2012-06-11  9:49 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2012-06-07 20:10 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-06-07
                 CC|                            |rguenth at gcc dot gnu.org
   Target Milestone|---                         |4.7.2
            Summary|Compiler ICEs in            |[4.7/4.8 Regression]
                   |size_binop_loc              |Compiler ICEs in
                   |                            |size_binop_loc
     Ever Confirmed|0                           |1

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2012-06-07 20:10:20 UTC ---
It is caused by revision 172261:

http://gcc.gnu.org/ml/gcc-cvs/2011-04/msg00456.html


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/53605] [4.7/4.8 Regression] Compiler ICEs in size_binop_loc
  2012-06-07 17:34 [Bug c++/53605] New: Compiler ICEs in size_binop_loc xinliangli at gmail dot com
  2012-06-07 20:10 ` [Bug c++/53605] [4.7/4.8 Regression] " hjl.tools at gmail dot com
@ 2012-06-11  9:49 ` rguenth at gcc dot gnu.org
  2012-06-11 10:38 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-11  9:49 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-11 09:49:04 UTC ---
Mine.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/53605] [4.7/4.8 Regression] Compiler ICEs in size_binop_loc
  2012-06-07 17:34 [Bug c++/53605] New: Compiler ICEs in size_binop_loc xinliangli at gmail dot com
  2012-06-07 20:10 ` [Bug c++/53605] [4.7/4.8 Regression] " hjl.tools at gmail dot com
  2012-06-11  9:49 ` rguenth at gcc dot gnu.org
@ 2012-06-11 10:38 ` rguenth at gcc dot gnu.org
  2012-06-11 13:41 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-11 10:38 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-11 10:37:50 UTC ---
Empty arrays have a signed domain with [0, -1] range.  So write_array_type
has to be adjusted to

Index: gcc/cp/mangle.c
===================================================================
--- gcc/cp/mangle.c     (revision 188384)
+++ gcc/cp/mangle.c     (working copy)
@@ -3119,7 +3119,8 @@ write_array_type (const tree type)
        {
          /* The ABI specifies that we should mangle the number of
             elements in the array, not the largest allowed index.  */
-         max = size_binop (PLUS_EXPR, max, size_one_node);
+         max = size_binop (PLUS_EXPR, max,
+                           build_int_cst (TREE_TYPE (max), 1));
          write_unsigned_number (tree_low_cst (max, 1));
        }
       else

or

Index: gcc/cp/mangle.c
===================================================================
--- gcc/cp/mangle.c     (revision 188384)
+++ gcc/cp/mangle.c     (working copy)
@@ -3119,8 +3119,10 @@ write_array_type (const tree type)
        {
          /* The ABI specifies that we should mangle the number of
             elements in the array, not the largest allowed index.  */
-         max = size_binop (PLUS_EXPR, max, size_one_node);
-         write_unsigned_number (tree_low_cst (max, 1));
+         double_int dmax
+           = double_int_add (tree_to_double_int (max), double_int_one);
+         gcc_assert (double_int_fits_in_uhwi_p (dmax));
+         write_unsigned_number (dmax.low);
        }
       else
        {

but I wonder about the inconsistency between the max == INTEGER_CST and
!INTEGER_CST case where we do _not_ add one to the expression to be mangled.

I'll give the double-int variant testing.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/53605] [4.7/4.8 Regression] Compiler ICEs in size_binop_loc
  2012-06-07 17:34 [Bug c++/53605] New: Compiler ICEs in size_binop_loc xinliangli at gmail dot com
                   ` (2 preceding siblings ...)
  2012-06-11 10:38 ` rguenth at gcc dot gnu.org
@ 2012-06-11 13:41 ` jason at gcc dot gnu.org
  2012-06-11 14:11 ` [Bug c++/53605] [4.7 " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2012-06-11 13:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-11 13:41:20 UTC ---
(In reply to comment #3)
> but I wonder about the inconsistency between the max == INTEGER_CST and
> !INTEGER_CST case where we do _not_ add one to the expression to be mangled.

Yep, that's what the ABI says.  I don't remember why we chose to add one in the
constant case.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/53605] [4.7 Regression] Compiler ICEs in size_binop_loc
  2012-06-07 17:34 [Bug c++/53605] New: Compiler ICEs in size_binop_loc xinliangli at gmail dot com
                   ` (3 preceding siblings ...)
  2012-06-11 13:41 ` jason at gcc dot gnu.org
@ 2012-06-11 14:11 ` rguenth at gcc dot gnu.org
  2012-06-11 14:22 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-11 14:11 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.8.0
            Summary|[4.7/4.8 Regression]        |[4.7 Regression] Compiler
                   |Compiler ICEs in            |ICEs in size_binop_loc
                   |size_binop_loc              |

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-11 14:10:59 UTC ---
Fixed on trunk sofar.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/53605] [4.7 Regression] Compiler ICEs in size_binop_loc
  2012-06-07 17:34 [Bug c++/53605] New: Compiler ICEs in size_binop_loc xinliangli at gmail dot com
                   ` (4 preceding siblings ...)
  2012-06-11 14:11 ` [Bug c++/53605] [4.7 " rguenth at gcc dot gnu.org
@ 2012-06-11 14:22 ` rguenth at gcc dot gnu.org
  2012-06-13 22:32 ` xinliangli at gmail dot com
  2012-06-14 13:03 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-11 14:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-11 14:22:41 UTC ---
Bah, commit (I fixed up the ChangeLog already):

Author: rguenth
Date: Mon Jun 11 13:58:29 2012
New Revision: 188386

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188386
Log:
2012-06-11  Richard Guenther  <rguenther@suse.de>

    PR c++/53616
    * mangle.c (write_array_type): Use double-ints for array domain
    arithmetic.

    * g++.dg/ext/pr53605.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/ext/pr53605.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/mangle.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/53605] [4.7 Regression] Compiler ICEs in size_binop_loc
  2012-06-07 17:34 [Bug c++/53605] New: Compiler ICEs in size_binop_loc xinliangli at gmail dot com
                   ` (5 preceding siblings ...)
  2012-06-11 14:22 ` rguenth at gcc dot gnu.org
@ 2012-06-13 22:32 ` xinliangli at gmail dot com
  2012-06-14 13:03 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: xinliangli at gmail dot com @ 2012-06-13 22:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from davidxl <xinliangli at gmail dot com> 2012-06-13 22:32:20 UTC ---
thanks for the fix. Is the fix going to be in gcc-4_7 branch?

David


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/53605] [4.7 Regression] Compiler ICEs in size_binop_loc
  2012-06-07 17:34 [Bug c++/53605] New: Compiler ICEs in size_binop_loc xinliangli at gmail dot com
                   ` (6 preceding siblings ...)
  2012-06-13 22:32 ` xinliangli at gmail dot com
@ 2012-06-14 13:03 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-14 13:03 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-14 13:02:46 UTC ---
Fixed.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-06-14 13:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-07 17:34 [Bug c++/53605] New: Compiler ICEs in size_binop_loc xinliangli at gmail dot com
2012-06-07 20:10 ` [Bug c++/53605] [4.7/4.8 Regression] " hjl.tools at gmail dot com
2012-06-11  9:49 ` rguenth at gcc dot gnu.org
2012-06-11 10:38 ` rguenth at gcc dot gnu.org
2012-06-11 13:41 ` jason at gcc dot gnu.org
2012-06-11 14:11 ` [Bug c++/53605] [4.7 " rguenth at gcc dot gnu.org
2012-06-11 14:22 ` rguenth at gcc dot gnu.org
2012-06-13 22:32 ` xinliangli at gmail dot com
2012-06-14 13:03 ` rguenth 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).