public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/27724]  New: internal compiler error: no-op convert from 4 to 8 bytes in initializer
@ 2006-05-22 16:59 bero at arklinux dot org
  2006-05-22 17:04 ` [Bug c++/27724] " bero at arklinux dot org
                   ` (20 more replies)
  0 siblings, 21 replies; 23+ messages in thread
From: bero at arklinux dot org @ 2006-05-22 16:59 UTC (permalink / raw)
  To: gcc-bugs

I agree the code is ugly... ;)
But it shouldn't cause an ICE anyway


-- 
           Summary: internal compiler error: no-op convert from 4 to 8 bytes
                    in initializer
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bero at arklinux dot org


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


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

* [Bug c++/27724] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
@ 2006-05-22 17:04 ` bero at arklinux dot org
  2006-05-22 17:06 ` pinskia at gcc dot gnu dot org
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: bero at arklinux dot org @ 2006-05-22 17:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from bero at arklinux dot org  2006-05-22 17:04 -------
Created an attachment (id=11493)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11493&action=view)
Preprocessor output


-- 


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


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

* [Bug c++/27724] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
  2006-05-22 17:04 ` [Bug c++/27724] " bero at arklinux dot org
@ 2006-05-22 17:06 ` pinskia at gcc dot gnu dot org
  2006-05-22 17:10 ` pinskia at gcc dot gnu dot org
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-22 17:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-05-22 17:06 -------
What target is this on?


-- 


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


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

* [Bug c++/27724] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
  2006-05-22 17:04 ` [Bug c++/27724] " bero at arklinux dot org
  2006-05-22 17:06 ` pinskia at gcc dot gnu dot org
@ 2006-05-22 17:10 ` pinskia at gcc dot gnu dot org
  2006-05-23  6:51 ` [Bug c++/27724] [4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-22 17:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-05-22 17:09 -------
The source you added is not free or open source.


-- 


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


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

* [Bug c++/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (2 preceding siblings ...)
  2006-05-22 17:10 ` pinskia at gcc dot gnu dot org
@ 2006-05-23  6:51 ` pinskia at gcc dot gnu dot org
  2006-05-23  9:02 ` rguenth at gcc dot gnu dot org
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-23  6:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-05-23 06:51 -------
Reduced testcase:
struct st{
  int _mark;
};
unsigned long long t = ((int)&(((struct st*)16)->_mark) - 16);

This is undefined code.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org, dj at redhat dot com
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2006-05-23 06:51:13
               date|                            |
            Summary|internal compiler error: no-|[4.1/4.2 Regression]
                   |op convert from 4 to 8 bytes|internal compiler error: no-
                   |in initializer              |op convert from 4 to 8 bytes
                   |                            |in initializer
   Target Milestone|---                         |4.1.1


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


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

* [Bug c++/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (3 preceding siblings ...)
  2006-05-23  6:51 ` [Bug c++/27724] [4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-05-23  9:02 ` rguenth at gcc dot gnu dot org
  2006-05-23 21:41 ` bero at arklinux dot org
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-05-23  9:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2006-05-23 09:02 -------
looks like creative offsetof


-- 


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


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

* [Bug c++/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (4 preceding siblings ...)
  2006-05-23  9:02 ` rguenth at gcc dot gnu dot org
@ 2006-05-23 21:41 ` bero at arklinux dot org
  2006-05-23 21:42   ` Andrew Pinski
  2006-05-23 21:43 ` pinskia at physics dot uc dot edu
                   ` (14 subsequent siblings)
  20 siblings, 1 reply; 23+ messages in thread
From: bero at arklinux dot org @ 2006-05-23 21:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from bero at arklinux dot org  2006-05-23 21:41 -------
It is creative offsetof indeed -- this a "explanation" from a bit of code
referenced to this one [while it isn't free yet, its license does allow posting
bits of it online]:



// HACK: gcc warns about applying offsetof() to non-POD object or calculating
//       offset directly when base address is NULL. Use 16 to get around the
//       warning. gcc-3.4 has an option -Wno-invalid-offsetof to suppress
//       this warning.
#define offset_of(klass,field) (size_t)((intx)&(((klas*)16)->field) - 16)



Looks like someone was desperate to get his stuff to compile with -Werror
without having to fix the cause.


-- 


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


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

* Re: [Bug c++/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-23 21:41 ` bero at arklinux dot org
@ 2006-05-23 21:42   ` Andrew Pinski
  0 siblings, 0 replies; 23+ messages in thread
From: Andrew Pinski @ 2006-05-23 21:42 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs

> 
> 
> 
> ------- Comment #6 from bero at arklinux dot org  2006-05-23 21:41 -------
> It is creative offsetof indeed -- this a "explanation" from a bit of code
> referenced to this one [while it isn't free yet, its license does allow posting
> bits of it online]:
> Looks like someone was desperate to get his stuff to compile with -Werror
> without having to fix the cause.

Well it is undefined for non-PODs to do offsetof which is why GCC warns.

-- Pinski


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

* [Bug c++/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (5 preceding siblings ...)
  2006-05-23 21:41 ` bero at arklinux dot org
@ 2006-05-23 21:43 ` pinskia at physics dot uc dot edu
  2006-05-25  2:42 ` mmitchel at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: pinskia at physics dot uc dot edu @ 2006-05-23 21:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at physics dot uc dot edu  2006-05-23 21:42 -------
Subject: Re:  [4.1/4.2 Regression] internal compiler error: no-op convert from
4 to 8 bytes in initializer

> 
> 
> 
> ------- Comment #6 from bero at arklinux dot org  2006-05-23 21:41 -------
> It is creative offsetof indeed -- this a "explanation" from a bit of code
> referenced to this one [while it isn't free yet, its license does allow posting
> bits of it online]:
> Looks like someone was desperate to get his stuff to compile with -Werror
> without having to fix the cause.

Well it is undefined for non-PODs to do offsetof which is why GCC warns.

-- Pinski


-- 


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


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

* [Bug c++/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (6 preceding siblings ...)
  2006-05-23 21:43 ` pinskia at physics dot uc dot edu
@ 2006-05-25  2:42 ` mmitchel at gcc dot gnu dot org
  2006-06-04 19:21 ` mmitchel at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-05-25  2:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from mmitchel at gcc dot gnu dot org  2006-05-25 02:35 -------
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.1                       |4.1.2


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


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

* [Bug c++/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (7 preceding siblings ...)
  2006-05-25  2:42 ` mmitchel at gcc dot gnu dot org
@ 2006-06-04 19:21 ` mmitchel at gcc dot gnu dot org
  2006-06-15  6:25 ` mmitchel at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-06-04 19:21 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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


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

* [Bug c++/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (8 preceding siblings ...)
  2006-06-04 19:21 ` mmitchel at gcc dot gnu dot org
@ 2006-06-15  6:25 ` mmitchel at gcc dot gnu dot org
  2006-06-15  6:33 ` pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-06-15  6:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from mmitchel at gcc dot gnu dot org  2006-06-15 06:25 -------
Eric --

Here, valid_initializer_constant_p returns true -- but output_constant aborts,
saying:

      /* Make sure eliminating the conversion is really a no-op, except with    
         VIEW_CONVERT_EXPRs to allow for wild Ada unchecked conversions and     
         union types to allow for Ada unchecked unions.  */
      if (type_size > op_size
          && TREE_CODE (exp) != VIEW_CONVERT_EXPR
          && TREE_CODE (TREE_TYPE (exp)) != UNION_TYPE)
        internal_error ("no-op convert from %wd to %wd bytes in initializer",
                        op_size, type_size);

I don't understand the assertion, given that removing it seems to generate
correct output for this test case.  Since you edited this code not to long ago,
do you have thoughts?

-- Mark


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at libertysurf dot
                   |                            |fr, mmitchel at gcc dot gnu
                   |                            |dot org


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


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

* [Bug c++/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (9 preceding siblings ...)
  2006-06-15  6:25 ` mmitchel at gcc dot gnu dot org
@ 2006-06-15  6:33 ` pinskia at gcc dot gnu dot org
  2006-06-15  6:45 ` ebotcazou at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-15  6:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pinskia at gcc dot gnu dot org  2006-06-15 06:32 -------
The error orginally came from:
2005-09-01  DJ Delorie  <dj@redhat.com>

        * varasm.c (output_constant): Let the target resolve
        conversions of addresses to non-default pointer sizes.

And then there were a couple of changes after that.


-- 


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


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

* [Bug c++/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (10 preceding siblings ...)
  2006-06-15  6:33 ` pinskia at gcc dot gnu dot org
@ 2006-06-15  6:45 ` ebotcazou at gcc dot gnu dot org
  2006-06-15 15:27 ` dj at redhat dot com
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-06-15  6:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from ebotcazou at gcc dot gnu dot org  2006-06-15 06:39 -------
> I don't understand the assertion, given that removing it seems to generate
> correct output for this test case.  Since you edited this code not to long ago,
> do you have thoughts?

Not really.  I've only loosened it since it broke Ada.  This is in DJ's court.


-- 


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


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

* [Bug c++/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (11 preceding siblings ...)
  2006-06-15  6:45 ` ebotcazou at gcc dot gnu dot org
@ 2006-06-15 15:27 ` dj at redhat dot com
  2006-06-15 15:30 ` mark at codesourcery dot com
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: dj at redhat dot com @ 2006-06-15 15:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from dj at redhat dot com  2006-06-15 15:19 -------
Subject: Re:  [4.1/4.2 Regression] internal compiler error: no-op convert from
4 to 8 bytes in initializer


> I don't understand the assertion, given that removing it seems to
> generate correct output for this test case.

The problem is that this function PADS rather than EXTENDS data that's
shorter than it's supposed to be, and it always pads in the same
direction - IIRC little endian.  Thus, it breaks on big endian
machines, or machines that require sign extension.


-- 


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


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

* [Bug c++/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (12 preceding siblings ...)
  2006-06-15 15:27 ` dj at redhat dot com
@ 2006-06-15 15:30 ` mark at codesourcery dot com
  2006-08-01 17:35 ` [Bug middle-end/27724] " dj at redhat dot com
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: mark at codesourcery dot com @ 2006-06-15 15:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from mark at codesourcery dot com  2006-06-15 15:27 -------
Subject: Re:  [4.1/4.2 Regression] internal compiler error:
 no-op convert from 4 to 8 bytes in initializer

dj at redhat dot com wrote:
> ------- Comment #12 from dj at redhat dot com  2006-06-15 15:19 -------
> Subject: Re:  [4.1/4.2 Regression] internal compiler error: no-op convert from
> 4 to 8 bytes in initializer
> 
> 
>> I don't understand the assertion, given that removing it seems to
>> generate correct output for this test case.
> 
> The problem is that this function PADS rather than EXTENDS data that's
> shorter than it's supposed to be, and it always pads in the same
> direction - IIRC little endian.  Thus, it breaks on big endian
> machines, or machines that require sign extension.

So, you believe that initializer_constant_valid_p should reject this
initializer then?


-- 


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


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

* [Bug middle-end/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (13 preceding siblings ...)
  2006-06-15 15:30 ` mark at codesourcery dot com
@ 2006-08-01 17:35 ` dj at redhat dot com
  2006-08-01 18:28 ` mmitchel at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: dj at redhat dot com @ 2006-08-01 17:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from dj at redhat dot com  2006-08-01 17:35 -------
First off, I was mostly just explaining that assertion.

Second, I think that this code can be a valid initializer - the value
we initialize to is, in this case, an 8 byte value which contains the
least significant 4 bytes of an offset.  Because of the masking, we
can't expect the assembler to figure it out, but the value happens to
fit in a 4 byte value (er, unless it's a HUGE structure ;) so the
compiler should be able to.  However, that doesn't mean it's a no-op
conversion.

What I mean here, is that we can't rely on the code where the assert
is to do the "conversion" for us, because it does it wrong.  That code
is designed to pad structures and such, not do type conversions.  If
you give it a 4 byte initializer, and ask for an 8 byte space to be
filled, it pads.  It does NOT actually convert anything, which causes
the problems I noted.

The reason I discovered this is because it was padding out an ADDRESS
on the m16c (pointers are smaller than the address space), and the
address was truncated.  Thus, not truly a no-op conversion.  So, I
added code to try to detect the cases where we *can* let the assembler
do the right thing (i.e. if there's a .op for the larger type), and
reject the cases that we know we can't handle.

The solution is to either add more special cases to the code where the
assertion is, or actually do the conversions beforehand (something
like simplify_rtx, but for trees, and perhaps knowing about signed vs
unsigned).  I think the optimizer could do this for this case, because
it knows that the resulting value is constrained to be known to fit
and not be truncated by the conversions, but I don't think that
output_constant should be expected to do those kinds of optimizations.


-- 


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


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

* [Bug middle-end/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (14 preceding siblings ...)
  2006-08-01 17:35 ` [Bug middle-end/27724] " dj at redhat dot com
@ 2006-08-01 18:28 ` mmitchel at gcc dot gnu dot org
  2006-08-01 18:38 ` dj at redhat dot com
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-08-01 18:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from mmitchel at gcc dot gnu dot org  2006-08-01 18:27 -------
DJ --

Thanks for the detailed comments.  I understand that the assertion is guarding
against some cases where we may silently generate wrong code (as with the
situation with pointers on the m16c).  However, we're now in the situation
where he have a mismatch between initializer_constant_valid_p and
output_constant, which is a recipe for ICEs.  It is a key invariant that
anything accepted by the former be something that can be output by the latter.

So, we need to figure out what to do.  My tentative inclination, given where we
are in the development cycle, is to remove your assertion.  We will generate
correct code much of the time (as, for example, in this test case, where
zero-extension is fine).  Another choice would be to reject this case as an
initializer, which will result in QoI regressions where initializers are now
performed dynamically instead of statically.  

I agree that your strategy of simplifying valid initializers to make them
obviously valid is best -- but I'm not sure we can easily implement that.

What do you think?

-- Mark


-- 


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


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

* [Bug middle-end/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (15 preceding siblings ...)
  2006-08-01 18:28 ` mmitchel at gcc dot gnu dot org
@ 2006-08-01 18:38 ` dj at redhat dot com
  2006-09-08  0:43 ` jason at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: dj at redhat dot com @ 2006-08-01 18:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from dj at redhat dot com  2006-08-01 18:37 -------
I think it's acceptable to temporarily disable that assertion for this release,
but (1) we should test that code on both big and little endian 64 bit machines
and see if it produces wrong code (perhaps with a larger offset to see if the
truncation is happening), and (2) we should consider re-enabling the assertion
later if so.

Ideally, the assertion only detects the case where it *will* produce wrong
code, at least on a big endian machine.  That might imply that more special
cases are needed for what is truly a no-op conversion, or an extra optimization
step before we check the initializers.


-- 


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


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

* [Bug middle-end/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (16 preceding siblings ...)
  2006-08-01 18:38 ` dj at redhat dot com
@ 2006-09-08  0:43 ` jason at gcc dot gnu dot org
  2006-09-08  5:11 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-09-08  0:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from jason at gcc dot gnu dot org  2006-09-08 00:43 -------
I don't think disabling the assertion is enough.  Yes, the compiler would do
the right thing for this particular testcase, but would be wrong if the
subtraction produces a negative result.

Rather, we should stop stripping the conversions in cases where they are
significant.  Testing a patch now.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-05-23 06:51:13         |2006-09-08 00:43:21
               date|                            |


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


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

* [Bug middle-end/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (17 preceding siblings ...)
  2006-09-08  0:43 ` jason at gcc dot gnu dot org
@ 2006-09-08  5:11 ` jason at gcc dot gnu dot org
  2006-09-08  5:16 ` jason at gcc dot gnu dot org
  2006-09-08  5:38 ` [Bug middle-end/27724] [4.1 " jason at gcc dot gnu dot org
  20 siblings, 0 replies; 23+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-09-08  5:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from jason at gcc dot gnu dot org  2006-09-08 05:11 -------
Subject: Bug 27724

Author: jason
Date: Fri Sep  8 05:11:40 2006
New Revision: 116777

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116777
Log:
        PR middle-end/27724
        * varasm.c (output_constant): Only strip actual no-op conversions.

Added:
    trunk/gcc/testsuite/gcc.dg/long-long-cst1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/varasm.c


-- 


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


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

* [Bug middle-end/27724] [4.1/4.2 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (18 preceding siblings ...)
  2006-09-08  5:11 ` jason at gcc dot gnu dot org
@ 2006-09-08  5:16 ` jason at gcc dot gnu dot org
  2006-09-08  5:38 ` [Bug middle-end/27724] [4.1 " jason at gcc dot gnu dot org
  20 siblings, 0 replies; 23+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-09-08  5:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from jason at gcc dot gnu dot org  2006-09-08 05:16 -------
Subject: Bug 27724

Author: jason
Date: Fri Sep  8 05:16:26 2006
New Revision: 116778

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116778
Log:
        PR middle-end/27724
        * varasm.c (output_constant): Only strip actual no-op conversions.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/long-long-cst1.c
      - copied unchanged from r116777,
trunk/gcc/testsuite/gcc.dg/long-long-cst1.c
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/varasm.c


-- 


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


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

* [Bug middle-end/27724] [4.1 Regression] internal compiler error: no-op convert from 4 to 8 bytes in initializer
  2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
                   ` (19 preceding siblings ...)
  2006-09-08  5:16 ` jason at gcc dot gnu dot org
@ 2006-09-08  5:38 ` jason at gcc dot gnu dot org
  20 siblings, 0 replies; 23+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-09-08  5:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from jason at gcc dot gnu dot org  2006-09-08 05:38 -------
fixed in 4.1 as well.


-- 

jason at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2006-09-08  5:38 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-22 16:59 [Bug c++/27724] New: internal compiler error: no-op convert from 4 to 8 bytes in initializer bero at arklinux dot org
2006-05-22 17:04 ` [Bug c++/27724] " bero at arklinux dot org
2006-05-22 17:06 ` pinskia at gcc dot gnu dot org
2006-05-22 17:10 ` pinskia at gcc dot gnu dot org
2006-05-23  6:51 ` [Bug c++/27724] [4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
2006-05-23  9:02 ` rguenth at gcc dot gnu dot org
2006-05-23 21:41 ` bero at arklinux dot org
2006-05-23 21:42   ` Andrew Pinski
2006-05-23 21:43 ` pinskia at physics dot uc dot edu
2006-05-25  2:42 ` mmitchel at gcc dot gnu dot org
2006-06-04 19:21 ` mmitchel at gcc dot gnu dot org
2006-06-15  6:25 ` mmitchel at gcc dot gnu dot org
2006-06-15  6:33 ` pinskia at gcc dot gnu dot org
2006-06-15  6:45 ` ebotcazou at gcc dot gnu dot org
2006-06-15 15:27 ` dj at redhat dot com
2006-06-15 15:30 ` mark at codesourcery dot com
2006-08-01 17:35 ` [Bug middle-end/27724] " dj at redhat dot com
2006-08-01 18:28 ` mmitchel at gcc dot gnu dot org
2006-08-01 18:38 ` dj at redhat dot com
2006-09-08  0:43 ` jason at gcc dot gnu dot org
2006-09-08  5:11 ` jason at gcc dot gnu dot org
2006-09-08  5:16 ` jason at gcc dot gnu dot org
2006-09-08  5:38 ` [Bug middle-end/27724] [4.1 " jason at gcc dot gnu dot 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).