public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/55359] New: [4.8 Regression] ICE in simplify_subreg accessing an unaligned subvector
@ 2012-11-16 19:17 glisse at gcc dot gnu.org
  2012-11-19 11:40 ` [Bug middle-end/55359] " jakub at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: glisse at gcc dot gnu.org @ 2012-11-16 19:17 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55359
           Summary: [4.8 Regression] ICE in simplify_subreg accessing an
                    unaligned subvector
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: glisse@gcc.gnu.org


I am not quite sure if this code is legal. I noticed it first with a
BIT_FIELD_REF (generated by a local patch), but it also happens with a MEM_REF.
The code generated by 4.7 seems correct, even if it isn't optimal.

$ cat s.c
#include <x86intrin.h>

__m128d f(__m256d x){
  return *((__m128d*)((double*)&x+1));
}
$ gcc s.c -mavx2 -S -O2
s.c: In function 'f':
s.c:4:3: internal compiler error: in simplify_subreg, at simplify-rtx.c:5688
   return *((__m128d*)((double*)&x+1));
   ^
0x9052f6 simplify_subreg(machine_mode, rtx_def*, machine_mode, unsigned int)
    /data/repos/gcc/pristine/gcc/simplify-rtx.c:5688
0x90b8bd simplify_gen_subreg(machine_mode, rtx_def*, machine_mode, unsigned
int)
    /data/repos/gcc/pristine/gcc/simplify-rtx.c:5903
0x6ec7e8 extract_bit_field_1
    /data/repos/gcc/pristine/gcc/expmed.c:1482
0x6ecda3 extract_bit_field(rtx_def*, unsigned long, unsigned long, int, bool,
rtx_def*, machine_mode, machine_mode)
    /data/repos/gcc/pristine/gcc/expmed.c:1711
0x6fa77e expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**)
    /data/repos/gcc/pristine/gcc/expr.c:10006
0x6fb505 expand_expr
    /data/repos/gcc/pristine/gcc/expr.h:444
0x6fb505 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**)
    /data/repos/gcc/pristine/gcc/expr.c:9614
0x6fb623 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**)
    /data/repos/gcc/pristine/gcc/expr.c:9179
0x9152a8 expand_expr
    /data/repos/gcc/pristine/gcc/expr.h:444
0x9152a8 expand_return(tree_node*)
    /data/repos/gcc/pristine/gcc/stmt.c:1546
0x635273 expand_gimple_stmt_1
    /data/repos/gcc/pristine/gcc/cfgexpand.c:2082
0x635273 expand_gimple_stmt
    /data/repos/gcc/pristine/gcc/cfgexpand.c:2204
0x636c82 expand_gimple_basic_block
    /data/repos/gcc/pristine/gcc/cfgexpand.c:3978
0x639aee gimple_expand_cfg
    /data/repos/gcc/pristine/gcc/cfgexpand.c:4497


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

* [Bug middle-end/55359] [4.8 Regression] ICE in simplify_subreg accessing an unaligned subvector
  2012-11-16 19:17 [Bug middle-end/55359] New: [4.8 Regression] ICE in simplify_subreg accessing an unaligned subvector glisse at gcc dot gnu.org
@ 2012-11-19 11:40 ` jakub at gcc dot gnu.org
  2012-11-19 19:00 ` rsandifo at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-19 11:40 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-11-19
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |rsandifo at gcc dot gnu.org
   Target Milestone|---                         |4.8.0
     Ever Confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-19 11:40:05 UTC ---
Caused by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192741
lowpart_bit_field_p looks weird, I don't see how BITS_PER_WORD is relevant
there, what IMHO matters is whether the subreg is valid or not.  While the
first hunk that uses this function uses validate_subreg, the second one doesn't
and
attempts to create an invalid subreg (subreg:V2DF (reg:OI) 8), where the byte
offset is not a multiple of V2DFmode size.


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

* [Bug middle-end/55359] [4.8 Regression] ICE in simplify_subreg accessing an unaligned subvector
  2012-11-16 19:17 [Bug middle-end/55359] New: [4.8 Regression] ICE in simplify_subreg accessing an unaligned subvector glisse at gcc dot gnu.org
  2012-11-19 11:40 ` [Bug middle-end/55359] " jakub at gcc dot gnu.org
@ 2012-11-19 19:00 ` rsandifo at gcc dot gnu.org
  2012-11-19 19:11 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2012-11-19 19:00 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> 2012-11-19 19:00:01 UTC ---
Sorry for the breakage.

(In reply to comment #1)
> Caused by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192741
> lowpart_bit_field_p looks weird, I don't see how BITS_PER_WORD is relevant
> there, what IMHO matters is whether the subreg is valid or not.  While the
> first hunk that uses this function uses validate_subreg, the second one doesn't
> and
> attempts to create an invalid subreg (subreg:V2DF (reg:OI) 8), where the byte
> offset is not a multiple of V2DFmode size.

I suppose we're going to have to decide whether simplify_subreg should
do the validation itself, or whether it's up to the caller.
simplify_subreg asserts things that validate_subreg checks,
which implies the latter, but simplify_gen_subreg explicitly
calls validate_subreg.

Personally I'd prefer it if simplify_subreg and simplify_gen_subreg
checked for invalid subregs and return null.  Does that sound OK?


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

* [Bug middle-end/55359] [4.8 Regression] ICE in simplify_subreg accessing an unaligned subvector
  2012-11-16 19:17 [Bug middle-end/55359] New: [4.8 Regression] ICE in simplify_subreg accessing an unaligned subvector glisse at gcc dot gnu.org
  2012-11-19 11:40 ` [Bug middle-end/55359] " jakub at gcc dot gnu.org
  2012-11-19 19:00 ` rsandifo at gcc dot gnu.org
@ 2012-11-19 19:11 ` jakub at gcc dot gnu.org
  2012-11-19 19:14 ` rsandifo at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-19 19:11 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-19 19:11:29 UTC ---
Guess it is ok.


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

* [Bug middle-end/55359] [4.8 Regression] ICE in simplify_subreg accessing an unaligned subvector
  2012-11-16 19:17 [Bug middle-end/55359] New: [4.8 Regression] ICE in simplify_subreg accessing an unaligned subvector glisse at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-11-19 19:11 ` jakub at gcc dot gnu.org
@ 2012-11-19 19:14 ` rsandifo at gcc dot gnu.org
  2012-11-19 23:28 ` rsandifo at gcc dot gnu.org
  2012-11-19 23:29 ` rsandifo at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2012-11-19 19:14 UTC (permalink / raw)
  To: gcc-bugs


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

rsandifo@gcc.gnu.org <rsandifo at gcc dot gnu.org> changed:

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

--- Comment #4 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> 2012-11-19 19:13:37 UTC ---
OK, thanks, I'll give it a go.


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

* [Bug middle-end/55359] [4.8 Regression] ICE in simplify_subreg accessing an unaligned subvector
  2012-11-16 19:17 [Bug middle-end/55359] New: [4.8 Regression] ICE in simplify_subreg accessing an unaligned subvector glisse at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2012-11-19 19:14 ` rsandifo at gcc dot gnu.org
@ 2012-11-19 23:28 ` rsandifo at gcc dot gnu.org
  2012-11-19 23:29 ` rsandifo at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2012-11-19 23:28 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> 2012-11-19 23:28:13 UTC ---
Author: rsandifo
Date: Mon Nov 19 23:28:04 2012
New Revision: 193640

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193640
Log:
gcc/
    PR middle-end/55359
    * simplify-rtx.c (simplify_subreg): Return null for invalid offsets.

gcc/testsuite/
    * gcc.target/i386/pr55359.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr55359.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/simplify-rtx.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug middle-end/55359] [4.8 Regression] ICE in simplify_subreg accessing an unaligned subvector
  2012-11-16 19:17 [Bug middle-end/55359] New: [4.8 Regression] ICE in simplify_subreg accessing an unaligned subvector glisse at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2012-11-19 23:28 ` rsandifo at gcc dot gnu.org
@ 2012-11-19 23:29 ` rsandifo at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2012-11-19 23:29 UTC (permalink / raw)
  To: gcc-bugs


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

rsandifo@gcc.gnu.org <rsandifo at gcc dot gnu.org> changed:

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

--- Comment #6 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> 2012-11-19 23:29:21 UTC ---
Fixed on trunk.


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

end of thread, other threads:[~2012-11-19 23:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-16 19:17 [Bug middle-end/55359] New: [4.8 Regression] ICE in simplify_subreg accessing an unaligned subvector glisse at gcc dot gnu.org
2012-11-19 11:40 ` [Bug middle-end/55359] " jakub at gcc dot gnu.org
2012-11-19 19:00 ` rsandifo at gcc dot gnu.org
2012-11-19 19:11 ` jakub at gcc dot gnu.org
2012-11-19 19:14 ` rsandifo at gcc dot gnu.org
2012-11-19 23:28 ` rsandifo at gcc dot gnu.org
2012-11-19 23:29 ` rsandifo 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).