public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/23155] New: Gimplification failed for union cast
@ 2005-07-31  4:22 dje at gcc dot gnu dot org
  2005-07-31  4:22 ` [Bug middle-end/23155] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: dje at gcc dot gnu dot org @ 2005-07-31  4:22 UTC (permalink / raw)
  To: gcc-bugs

I am not sure that the example is valid GCC-extended C, but GCC definitely
should not ICE with "gimplification failed".  The example is:

typedef short __attribute__((vector_size (16))) v8hi;
union vx {short f[8]; v8hi v;};

extern void bar1(v8hi);

void
foo5 (v8hi vec, short n)
{
  ((union vx) vec).f[5] = n;
  bar1 (foo.v);
}

This is either ice-on-valid or ice-on-invalid, but something is broken.

-- 
           Summary: Gimplification failed for union cast
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dje at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: *-*-*
  GCC host triplet: *-*-*
GCC target triplet: *-*-*


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


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

* [Bug middle-end/23155] [4.0/4.1 Regression] Gimplification failed for union cast
  2005-07-31  4:22 [Bug tree-optimization/23155] New: Gimplification failed for union cast dje at gcc dot gnu dot org
@ 2005-07-31  4:22 ` pinskia at gcc dot gnu dot org
  2005-07-31  4:23 ` [Bug tree-optimization/23155] " dje at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-31  4:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-31 04:21 -------
The front-end produces:
  {.v=vec}.f[5] = n;


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|tree-optimization           |middle-end
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-07-31 04:21:21
               date|                            |
            Summary|Gimplification failed for   |[4.0/4.1 Regression]
                   |union cast                  |Gimplification failed for
                   |                            |union cast
   Target Milestone|---                         |4.0.2


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


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

* [Bug tree-optimization/23155] Gimplification failed for union cast
  2005-07-31  4:22 [Bug tree-optimization/23155] New: Gimplification failed for union cast dje at gcc dot gnu dot org
  2005-07-31  4:22 ` [Bug middle-end/23155] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-07-31  4:23 ` dje at gcc dot gnu dot org
  2005-07-31  4:25 ` [Bug middle-end/23155] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: dje at gcc dot gnu dot org @ 2005-07-31  4:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dje at gcc dot gnu dot org  2005-07-31 04:21 -------
Sorry, there was a typo in the previous example.  The correct example is:

typedef short __attribute__((vector_size (16))) v8hi;
union vx {short f[8]; v8hi v;};

extern void bar1(v8hi);

void
foo5 (v8hi vec, short n)
{
  ((union vx) vec).f[5] = n;
  bar1 (vec);
}

and the output is:

$ ./xgcc -B./ -O0 -S a.c
gimplification failed:
{.v=vec} <constructor 0x426c1c00
    type <union_type 0x426ba770 vx type_0 BLK
        size <integer_cst 0x42611a60 constant invariant 128>
        unit size <integer_cst 0x42611a80 constant invariant 16>
        align 128 symtab 0 alias set -1
        fields <field_decl 0x426ba8c0 f type <array_type 0x42694d20>
            BLK file a.c line 2 size <integer_cst 0x42611a60 128> unit size
<integer_cst 0x42611a80 16>
            align 16 offset_align 128
            offset <integer_cst 0x42611400 constant invariant 0>
            bit offset <integer_cst 0x42611e80 constant invariant 0> context
<union_type 0x426ba770 vx> chain <field_decl 0x426ba930 v>>
        chain <type_decl 0x42620a00 D.1265>>
   
    arg 0 <tree_list 0x426c1be0
        purpose <field_decl 0x426ba930 v type <vector_type 0x426ba700 v8hi>
            TI file a.c line 2 size <integer_cst 0x42611a60 128> unit size
<integer_cst 0x42611a80 16>
            align 128 offset_align 128 offset <integer_cst 0x42611400 0> bit
offset <integer_cst 0x42611e80 0> context <union_type 0x426ba770 vx>>
        value <parm_decl 0x426baa80 vec type <vector_type 0x426ba700 v8hi>
            used TI file a.c line 7 size <integer_cst 0x42611a60 128> unit size 
<integer_cst 0x42611a80 16>
            align 128 context <function_decl 0x426bb800 foo5> initial
<vector_type 0x426ba700 v8hi> arg-type <vector_type 0x426ba700 v8hi> chain
<parm_decl 0x426baaf0 n>>>>
a.c: In function 'foo5':
a.c:9: internal compiler error: gimplification failed

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |tree-optimization
            Summary|[4.0/4.1 Regression]        |Gimplification failed for
                   |Gimplification failed for   |union cast
                   |union cast                  |
   Target Milestone|4.0.2                       |---


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


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

* [Bug middle-end/23155] [4.0/4.1 Regression] Gimplification failed for union cast
  2005-07-31  4:22 [Bug tree-optimization/23155] New: Gimplification failed for union cast dje at gcc dot gnu dot org
  2005-07-31  4:22 ` [Bug middle-end/23155] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
  2005-07-31  4:23 ` [Bug tree-optimization/23155] " dje at gcc dot gnu dot org
@ 2005-07-31  4:25 ` pinskia at gcc dot gnu dot org
  2005-07-31  4:25 ` [Bug tree-optimization/23155] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-31  4:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-31 04:25 -------
If we give -pedantic-errors we reject it with an error but still ICE.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |error-recovery, ice-on-
                   |                            |invalid-code


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


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

* [Bug tree-optimization/23155] [4.0/4.1 Regression] Gimplification failed for union cast
  2005-07-31  4:22 [Bug tree-optimization/23155] New: Gimplification failed for union cast dje at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-07-31  4:25 ` [Bug middle-end/23155] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-07-31  4:25 ` pinskia at gcc dot gnu dot org
  2005-08-04  9:20 ` [Bug c/23155] " rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-31  4:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-31 04:23 -------
Here is another testcase:
union vx {short f[8]; int v;};
int vec;

void
foo5 (int vec)
{
  ((union vx) vec).f[5] = 1;
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Gimplification failed for   |[4.0/4.1 Regression]
                   |union cast                  |Gimplification failed for
                   |                            |union cast
   Target Milestone|---                         |4.0.2


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


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

* [Bug c/23155] [4.0/4.1 Regression] Gimplification failed for union cast
  2005-07-31  4:22 [Bug tree-optimization/23155] New: Gimplification failed for union cast dje at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-07-31  4:25 ` [Bug tree-optimization/23155] " pinskia at gcc dot gnu dot org
@ 2005-08-04  9:20 ` rguenth at gcc dot gnu dot org
  2005-08-08 18:26 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-08-04  9:20 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1056 bytes --]


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-08-04 09:20 -------
It's an lvalue-cast, which we no longer support as an extension.  So it's ICE on
invalid and a frontend bug.  The C++ frontend spits out the interesting error

pr23155.c: In function ‘void foo5(int)’:
pr23155.c:7: error: no matching function for call to ‘vx::vx(int&)‘
pr23155.c:1: note: candidates are: vx::vx()
pr23155.c:1: note:                 vx::vx(const vx&)

The following get's rejected with what should be done with the original
testcase, too:

union vx {short f[8]; int v;};
int vec;

void bar(short *);

void
foo5 (int vec)
{
  bar(((union vx) vec).f);
}

pr23155.c: In function ‘foo5’:
pr23155.c:10: error: invalid use of non-lvalue array


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |c
           Keywords|ice-on-valid-code           |accepts-invalid


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


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

* [Bug c/23155] [4.0/4.1 Regression] Gimplification failed for union cast
  2005-07-31  4:22 [Bug tree-optimization/23155] New: Gimplification failed for union cast dje at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-08-04  9:20 ` [Bug c/23155] " rguenth at gcc dot gnu dot org
@ 2005-08-08 18:26 ` pinskia at gcc dot gnu dot org
  2005-09-16 20:22 ` janis at gcc dot gnu dot org
  2005-09-27 16:00 ` mmitchel at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-08 18:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-08 18:26 -------
: Search converges between 2004-06-20-trunk (#469) and 2004-06-22-trunk (#470).


Hmm, this was not introduced by the tree-ssa merge weird.

-- 


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


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

* [Bug c/23155] [4.0/4.1 Regression] Gimplification failed for union cast
  2005-07-31  4:22 [Bug tree-optimization/23155] New: Gimplification failed for union cast dje at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-08-08 18:26 ` pinskia at gcc dot gnu dot org
@ 2005-09-16 20:22 ` janis at gcc dot gnu dot org
  2005-09-27 16:00 ` mmitchel at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: janis at gcc dot gnu dot org @ 2005-09-16 20:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From janis at gcc dot gnu dot org  2005-09-16 20:22 -------
The testcase from comment #5 ICEs starting with this patch from kenner:

  http://gcc.gnu.org/ml/gcc-cvs/2004-06/msg00881.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kenner at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c/23155] [4.0/4.1 Regression] Gimplification failed for union cast
  2005-07-31  4:22 [Bug tree-optimization/23155] New: Gimplification failed for union cast dje at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2005-09-16 20:22 ` janis at gcc dot gnu dot org
@ 2005-09-27 16:00 ` mmitchel at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:00 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.2                       |4.0.3


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


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

* [Bug c/23155] [4.0/4.1 Regression] Gimplification failed for union cast
       [not found] <bug-23155-327@http.gcc.gnu.org/bugzilla/>
  2005-10-27 20:01 ` pinskia at gcc dot gnu dot org
@ 2005-10-27 21:15 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-27 21:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gcc dot gnu dot org  2005-10-27 21:15 -------
This is a combination of a GCC extension (of cast to union) and a C99 feature
(subscripting a non-lvalue array) so this is valid code (but undefined code)
even though it looks so weird.

Anyways I have a patch which I am testing.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
           Keywords|accepts-invalid             |


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


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

* [Bug c/23155] [4.0/4.1 Regression] Gimplification failed for union cast
       [not found] <bug-23155-327@http.gcc.gnu.org/bugzilla/>
@ 2005-10-27 20:01 ` pinskia at gcc dot gnu dot org
  2005-10-27 21:15 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-27 20:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2005-10-27 20:01 -------
I might look into this soon.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org


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


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

end of thread, other threads:[~2005-10-27 21:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-31  4:22 [Bug tree-optimization/23155] New: Gimplification failed for union cast dje at gcc dot gnu dot org
2005-07-31  4:22 ` [Bug middle-end/23155] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-07-31  4:23 ` [Bug tree-optimization/23155] " dje at gcc dot gnu dot org
2005-07-31  4:25 ` [Bug middle-end/23155] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-07-31  4:25 ` [Bug tree-optimization/23155] " pinskia at gcc dot gnu dot org
2005-08-04  9:20 ` [Bug c/23155] " rguenth at gcc dot gnu dot org
2005-08-08 18:26 ` pinskia at gcc dot gnu dot org
2005-09-16 20:22 ` janis at gcc dot gnu dot org
2005-09-27 16:00 ` mmitchel at gcc dot gnu dot org
     [not found] <bug-23155-327@http.gcc.gnu.org/bugzilla/>
2005-10-27 20:01 ` pinskia at gcc dot gnu dot org
2005-10-27 21:15 ` pinskia 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).