public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88
@ 2012-12-04 21:01 hjl.tools at gmail dot com
  2012-12-04 22:29 ` [Bug middle-end/55597] " hjl.tools at gmail dot com
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: hjl.tools at gmail dot com @ 2012-12-04 21:01 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55597
           Summary: [4.8 Regression] internal compiler error: in
                    plus_constant, at explow.c:88
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hjl.tools@gmail.com


On Linux/x86-64, revision 194159 gave:

[hjl@gnu-ivb-1 gcc]$ cat /tmp/testcase.c 
struct initial_sp {
  void *sp;
  int mask;
};
void foo (int *);
__thread struct initial_sp __morestack_initial_sp;
void __morestack_release_segments (void) {
  foo (&__morestack_initial_sp.mask);
}
[hjl@gnu-ivb-1 gcc]$ ./xgcc -B./ -fPIC -O2 -mx32 -S -maddress-mode=long
/tmp/testcase.c 
/tmp/testcase.c: In function ‘__morestack_release_segments’:
/tmp/testcase.c:9:1: internal compiler error: in plus_constant, at explow.c:88
 }
 ^
0x7321f3 plus_constant(machine_mode, rtx_def*, long)
    /export/gnu/import/git/gcc/gcc/explow.c:88
0x5fdee7 init_alias_analysis()
    /export/gnu/import/git/gcc/gcc/alias.c:2945
0xfce2ce cse_main
    /export/gnu/import/git/gcc/gcc/cse.c:6543
0xfd010e rest_of_handle_cse
    /export/gnu/import/git/gcc/gcc/cse.c:7435
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
[hjl@gnu-ivb-1 gcc]$


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

* [Bug middle-end/55597] [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88
  2012-12-04 21:01 [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88 hjl.tools at gmail dot com
@ 2012-12-04 22:29 ` hjl.tools at gmail dot com
  2012-12-04 22:52 ` bonzini at gnu dot org
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hjl.tools at gmail dot com @ 2012-12-04 22:29 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-12-04
                 CC|                            |bonzini at gnu dot org
   Target Milestone|---                         |4.8.0
     Ever Confirmed|0                           |1

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2012-12-04 22:29:34 UTC ---
It is caused by revision 193868:

http://gcc.gnu.org/ml/gcc-cvs/2012-11/msg00816.html


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

* [Bug middle-end/55597] [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88
  2012-12-04 21:01 [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88 hjl.tools at gmail dot com
  2012-12-04 22:29 ` [Bug middle-end/55597] " hjl.tools at gmail dot com
@ 2012-12-04 22:52 ` bonzini at gnu dot org
  2012-12-04 23:25 ` [Bug target/55597] " steven at gcc dot gnu.org
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: bonzini at gnu dot org @ 2012-12-04 22:52 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Bonzini <bonzini at gnu dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stevenb.gcc at gmail dot
                   |                            |com

--- Comment #2 from Paolo Bonzini <bonzini at gnu dot org> 2012-12-04 22:52:17 UTC ---
Really caused by the alias analysis change.


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

* [Bug target/55597] [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88
  2012-12-04 21:01 [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88 hjl.tools at gmail dot com
  2012-12-04 22:29 ` [Bug middle-end/55597] " hjl.tools at gmail dot com
  2012-12-04 22:52 ` bonzini at gnu dot org
@ 2012-12-04 23:25 ` steven at gcc dot gnu.org
  2012-12-04 23:46 ` [Bug target/55597] " steven at gcc dot gnu.org
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: steven at gcc dot gnu.org @ 2012-12-04 23:25 UTC (permalink / raw)
  To: gcc-bugs


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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |steven at gcc dot gnu.org
          Component|middle-end                  |target

--- Comment #3 from Steven Bosscher <steven at gcc dot gnu.org> 2012-12-04 23:24:41 UTC ---
Out of expand GCC produces:

(insn 6 5 7 2 (set (reg:DI 61)
        (reg:DI 0 ax)) t.c:8 -1
     (expr_list:REG_EQUAL (symbol_ref:SI ("__morestack_initial_sp") \
   [flags 0x10]  <var_decl 0x7ffff6263720 __morestack_initial_sp>)
        (nil)))
(insn 7 6 8 2 (parallel [
            (set (reg:DI 62)
                (plus:DI (reg:DI 61)
                    (const_int 4 [0x4])))
            (clobber (reg:CC 17 flags))
        ]) t.c:8 -1
     (nil))

In alias.c, the compiler tries to simplify r62=r61+4 to
r62=symbol_ref:SI ("__morestack_initial_sp")+4 but plus_constant
doesn't accept symbol_ref:SI ("__morestack_initial_sp") because it
is is SImode but should be DImode.

Back-end bug, I'm guessing something Pmode related.


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

* [Bug target/55597] internal compiler error: in plus_constant, at explow.c:88
  2012-12-04 21:01 [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88 hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2012-12-04 23:25 ` [Bug target/55597] " steven at gcc dot gnu.org
@ 2012-12-04 23:46 ` steven at gcc dot gnu.org
  2012-12-04 23:50 ` [Bug middle-end/55597] " hjl.tools at gmail dot com
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: steven at gcc dot gnu.org @ 2012-12-04 23:46 UTC (permalink / raw)
  To: gcc-bugs


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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x32
                 CC|steven at gcc dot gnu.org,  |
                   |stevenb.gcc at gmail dot    |
                   |com                         |
            Summary|[4.8 Regression] internal   |internal compiler error: in
                   |compiler error: in          |plus_constant, at
                   |plus_constant, at           |explow.c:88
                   |explow.c:88                 |

--- Comment #4 from Steven Bosscher <steven at gcc dot gnu.org> 2012-12-04 23:46:01 UTC ---
Yup, target bug.

(gdb) down
#5  0x0000000000d165b2 in ix86_expand_move (mode=SImode,
operands=0x7fffffffc740) at ../../trunk/gcc/config/i386/i386.c:15936
15936           tmp = legitimize_tls_address (symbol, model, true);
(gdb) l
15931         rtx symbol = XEXP (XEXP (op1, 0), 0);
15932         rtx tmp = NULL;
15933
15934         model = SYMBOL_REF_TLS_MODEL (symbol);
15935         if (model)
15936           tmp = legitimize_tls_address (symbol, model, true);
15937         else if (TARGET_DLLIMPORT_DECL_ATTRIBUTES
15938                  && SYMBOL_REF_DLLIMPORT_P (symbol))
15939           tmp = legitimize_dllimport_symbol (symbol, true);
15940
(gdb) p debug_rtx(op0)
(reg:SI 60)
$11 = void
(gdb) p debug_rtx(op1)
(const:SI (plus:SI (symbol_ref:SI ("__morestack_initial_sp") [flags 0x10]
<var_decl 0x7ffff6301720 __morestack_initial_sp>)
        (const_int 4 [0x4])))
$12 = void
(gdb) p debug_rtx(addend)
(const_int 4 [0x4])
$13 = void
(gdb) p debug_rtx(symbol)
(symbol_ref:SI ("__morestack_initial_sp") [flags 0x10] <var_decl 0x7ffff6301720
__morestack_initial_sp>)
$14 = void
(gdb) 


Note how this tries to expand an SImode move.

Breakpoint 2, legitimize_tls_address (x=0x7ffff6401660, model=TLS_MODEL_REAL,
for_mov=true) at ../../trunk/gcc/config/i386/i386.c:12758
12758     rtx pic = NULL_RTX, tp = NULL_RTX;
(gdb) p debug_rtx(x)
(symbol_ref:SI ("__morestack_initial_sp") [flags 0x10] <var_decl 0x7ffff6301720
__morestack_initial_sp>)
$15 = void
(gdb) next
12759     enum machine_mode tp_mode = Pmode;
(gdb) 
12762     switch (model)
(gdb) 
12765         dest = gen_reg_rtx (Pmode);
(gdb) p Pmode
$16 = DImode

So now you're in trouble...

And for the record: This can never be a regression, X32 doesn't exist in
previous GCC releases.


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

* [Bug middle-end/55597] internal compiler error: in plus_constant, at explow.c:88
  2012-12-04 21:01 [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88 hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2012-12-04 23:46 ` [Bug target/55597] " steven at gcc dot gnu.org
@ 2012-12-04 23:50 ` hjl.tools at gmail dot com
  2012-12-05 11:34 ` [Bug middle-end/55597] [4.8 Regression] " ebotcazou at gcc dot gnu.org
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hjl.tools at gmail dot com @ 2012-12-04 23:50 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |middle-end

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> 2012-12-04 23:49:48 UTC ---
(In reply to comment #4)
> And for the record: This can never be a regression, X32 doesn't exist in
> previous GCC releases.

Last time when I checked, GCC 4.7 supports x32.


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

* [Bug middle-end/55597] [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88
  2012-12-04 21:01 [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88 hjl.tools at gmail dot com
                   ` (4 preceding siblings ...)
  2012-12-04 23:50 ` [Bug middle-end/55597] " hjl.tools at gmail dot com
@ 2012-12-05 11:34 ` ebotcazou at gcc dot gnu.org
  2012-12-05 17:28 ` hjl.tools at gmail dot com
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2012-12-05 11:34 UTC (permalink / raw)
  To: gcc-bugs


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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

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

--- Comment #6 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2012-12-05 11:34:33 UTC ---
> Out of expand GCC produces:
> 
> (insn 6 5 7 2 (set (reg:DI 61)
>         (reg:DI 0 ax)) t.c:8 -1
>      (expr_list:REG_EQUAL (symbol_ref:SI ("__morestack_initial_sp") \
>    [flags 0x10]  <var_decl 0x7ffff6263720 __morestack_initial_sp>)
>         (nil)))
> (insn 7 6 8 2 (parallel [
>             (set (reg:DI 62)
>                 (plus:DI (reg:DI 61)
>                     (const_int 4 [0x4])))
>             (clobber (reg:CC 17 flags))
>         ]) t.c:8 -1
>      (nil))

The REG_EQUAL note is already wrong here.


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

* [Bug middle-end/55597] [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88
  2012-12-04 21:01 [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88 hjl.tools at gmail dot com
                   ` (5 preceding siblings ...)
  2012-12-05 11:34 ` [Bug middle-end/55597] [4.8 Regression] " ebotcazou at gcc dot gnu.org
@ 2012-12-05 17:28 ` hjl.tools at gmail dot com
  2012-12-05 17:56 ` hjl.tools at gmail dot com
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hjl.tools at gmail dot com @ 2012-12-05 17:28 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> 2012-12-05 17:28:11 UTC ---
It is generated by

(gdb) bt
#0  set_unique_reg_note (insn=0x7ffff19a07e0, kind=REG_EQUAL, 
    datum=0x7ffff1ab4460) at /export/gnu/import/git/gcc/gcc/emit-rtl.c:4958
#1  0x0000000000726f1b in set_dst_reg_note (insn=0x7ffff19a07e0, 
    kind=REG_EQUAL, datum=0x7ffff1ab4460, dst=0x7ffff1ab44c0)
    at /export/gnu/import/git/gcc/gcc/emit-rtl.c:5018
#2  0x0000000000949cbb in emit_libcall_block_1 (insns=0x7ffff1ab2730, 
    target=0x7ffff1ab44c0, result=0x7ffff1ab4500, equiv=0x7ffff1ab4460, 
    equiv_may_trap=false) at /export/gnu/import/git/gcc/gcc/optabs.c:3936
#3  0x0000000000949d10 in emit_libcall_block (insns=0x7ffff1ab2730, 
    target=0x7ffff1ab44c0, result=0x7ffff1ab4500, equiv=0x7ffff1ab4460)
    at /export/gnu/import/git/gcc/gcc/optabs.c:3945
#4  0x0000000000d082fa in legitimize_tls_address (x=0x7ffff1ab4460, 
    model=TLS_MODEL_REAL, for_mov=true)
    at /export/gnu/import/git/gcc/gcc/config/i386/i386.c:12805
#5  0x0000000000d0f4bb in ix86_expand_move (mode=SImode, 
    operands=0x7fffffffc920)
    at /export/gnu/import/git/gcc/gcc/config/i386/i386.c:15936
#6  0x0000000000dc1b60 in gen_movsi (operand0=0x7ffff1ab44a0, 
    operand1=0x7ffff1aac2f0)
    at /export/gnu/import/git/gcc/gcc/config/i386/i386.md:1701
#7  0x0000000000750380 in emit_move_insn_1 (x=0x7ffff1ab44a0, y=0x7ffff1aac2f0)
    at /export/gnu/import/git/gcc/gcc/expr.c:3417
#8  0x00000000007507cd in emit_move_insn (x=0x7ffff1ab44a0, y=0x7ffff1aac2f0)
---Type <return> to continue, or q <return> to quit---
    at /export/gnu/import/git/gcc/gcc/expr.c:3511
#9  0x0000000000733def in copy_to_mode_reg (mode=SImode, x=0x7ffff1aac2f0)
    at /export/gnu/import/git/gcc/gcc/explow.c:645
#10 0x00000000009537f9 in maybe_legitimize_operand (
    icode=CODE_FOR_zero_extendsidi2, opno=1, op=0x7fffffffcad0)
    at /export/gnu/import/git/gcc/gcc/optabs.c:8069
#11 0x0000000000953ac8 in maybe_legitimize_operands (
    icode=CODE_FOR_zero_extendsidi2, opno=0, nops=2, ops=0x7fffffffcac0)
    at /export/gnu/import/git/gcc/gcc/optabs.c:8131
#12 0x0000000000953b5b in maybe_gen_insn (icode=CODE_FOR_zero_extendsidi2, 
    nops=2, ops=0x7fffffffcac0) at /export/gnu/import/git/gcc/gcc/optabs.c:8149
#13 0x0000000000949697 in maybe_emit_unop_insn (
    icode=CODE_FOR_zero_extendsidi2, target=0x7ffff1ab4480, 
    op0=0x7ffff1aac2f0, code=ZERO_EXTEND)
    at /export/gnu/import/git/gcc/gcc/optabs.c:3765
#14 0x000000000094976b in emit_unop_insn (icode=CODE_FOR_zero_extendsidi2, 
    target=0x7ffff1ab4480, op0=0x7ffff1aac2f0, code=ZERO_EXTEND)
    at /export/gnu/import/git/gcc/gcc/optabs.c:3787
#15 0x0000000000748f7a in convert_move (to=0x7ffff1ab4480, 
    from=0x7ffff1aac2f0, unsignedp=1)
    at /export/gnu/import/git/gcc/gcc/expr.c:607

(gdb) f 2
#2  0x0000000000949cbb in emit_libcall_block_1 (insns=0x7ffff1ab2730, 
    target=0x7ffff1ab44c0, result=0x7ffff1ab4500, equiv=0x7ffff1ab4460, 
    equiv_may_trap=false) at /export/gnu/import/git/gcc/gcc/optabs.c:3936
3936      set_dst_reg_note (last, REG_EQUAL, copy_rtx (equiv), target);
(gdb) call debug_rtx (last)
(insn 6 5 0 (set (reg:DI 61)
        (reg:DI 0 ax)) x.i:8 -1
     (nil))
(gdb) call debug_rtx (equiv)
(symbol_ref:SI ("__morestack_initial_sp") [flags 0x10] <var_decl 0x7ffff19bf390
__morestack_initial_sp>)
(gdb)


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

* [Bug middle-end/55597] [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88
  2012-12-04 21:01 [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88 hjl.tools at gmail dot com
                   ` (6 preceding siblings ...)
  2012-12-05 17:28 ` hjl.tools at gmail dot com
@ 2012-12-05 17:56 ` hjl.tools at gmail dot com
  2012-12-05 20:46 ` ubizjak at gmail dot com
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hjl.tools at gmail dot com @ 2012-12-05 17:56 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> 2012-12-05 17:55:51 UTC ---
Does this patch

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index a24e407..b496490 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -12802,6 +12802,8 @@ legitimize_tls_address (rtx x, enum tls_model model,
bool for_mov)
           end_sequence ();

           RTL_CONST_CALL_P (insns) = 1;
+          if (GET_MODE (x) != Pmode)
+        x = gen_rtx_ZERO_EXTEND (Pmode, x);
           emit_libcall_block (insns, dest, rax, x);
         }
       else

make any senses?


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

* [Bug middle-end/55597] [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88
  2012-12-04 21:01 [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88 hjl.tools at gmail dot com
                   ` (7 preceding siblings ...)
  2012-12-05 17:56 ` hjl.tools at gmail dot com
@ 2012-12-05 20:46 ` ubizjak at gmail dot com
  2012-12-06  0:22 ` hjl.tools at gmail dot com
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: ubizjak at gmail dot com @ 2012-12-05 20:46 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #9 from Uros Bizjak <ubizjak at gmail dot com> 2012-12-05 20:45:40 UTC ---
I think it is better to fixup all sites where equivalent is used:

--cut here--
Index: i386.c
===================================================================
--- i386.c      (revision 194226)
+++ i386.c      (working copy)
@@ -12754,11 +12754,17 @@ ix86_tls_module_base (void)
 static rtx
 legitimize_tls_address (rtx x, enum tls_model model, bool for_mov)
 {
+  rtx xeq;
   rtx dest, base, off;
   rtx pic = NULL_RTX, tp = NULL_RTX;
   enum machine_mode tp_mode = Pmode;
   int type;

+  if (GET_MODE (x) != Pmode)
+    xeq = gen_rtx_ZERO_EXTEND (Pmode, x);
+  else
+    xeq = x;
+
   switch (model)
     {
     case TLS_MODEL_GLOBAL_DYNAMIC:
@@ -12785,7 +12791,7 @@ legitimize_tls_address (rtx x, enum tls_model mode
          tp = get_thread_pointer (Pmode, true);
          dest = force_reg (Pmode, gen_rtx_PLUS (Pmode, tp, dest));

-         set_unique_reg_note (get_last_insn (), REG_EQUAL, x);
+         set_unique_reg_note (get_last_insn (), REG_EQUAL, xeq);
        }
       else
        {
@@ -12802,7 +12808,7 @@ legitimize_tls_address (rtx x, enum tls_model mode
              end_sequence ();

              RTL_CONST_CALL_P (insns) = 1;
-             emit_libcall_block (insns, dest, rax, x);
+             emit_libcall_block (insns, dest, rax, xeq);
            }
          else
            emit_insn (gen_tls_global_dynamic_32 (dest, x, pic, caddr));
@@ -12871,7 +12877,7 @@ legitimize_tls_address (rtx x, enum tls_model mode
        {
          dest = force_reg (Pmode, gen_rtx_PLUS (Pmode, dest, tp));

-         set_unique_reg_note (get_last_insn (), REG_EQUAL, x);
+         set_unique_reg_note (get_last_insn (), REG_EQUAL, xeq);
        }
       break;

--cut here--


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

* [Bug middle-end/55597] [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88
  2012-12-04 21:01 [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88 hjl.tools at gmail dot com
                   ` (8 preceding siblings ...)
  2012-12-05 20:46 ` ubizjak at gmail dot com
@ 2012-12-06  0:22 ` hjl.tools at gmail dot com
  2012-12-06 15:05 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hjl.tools at gmail dot com @ 2012-12-06  0:22 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #10 from H.J. Lu <hjl.tools at gmail dot com> 2012-12-06 00:21:55 UTC ---
(In reply to comment #9)
> I think it is better to fixup all sites where equivalent is used:
> 

It works.  Thanks.


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

* [Bug middle-end/55597] [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88
  2012-12-04 21:01 [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88 hjl.tools at gmail dot com
                   ` (9 preceding siblings ...)
  2012-12-06  0:22 ` hjl.tools at gmail dot com
@ 2012-12-06 15:05 ` jakub at gcc dot gnu.org
  2012-12-06 20:14 ` ubizjak at gmail dot com
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-12-06 15:05 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-12-06 15:05:15 UTC ---
(In reply to comment #10)
> (In reply to comment #9)
> > I think it is better to fixup all sites where equivalent is used:
> > 
> 
> It works.  Thanks.

Unfortunately it creates GC garbage often unnecessary, when it won't be used at
all.


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

* [Bug middle-end/55597] [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88
  2012-12-04 21:01 [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88 hjl.tools at gmail dot com
                   ` (10 preceding siblings ...)
  2012-12-06 15:05 ` jakub at gcc dot gnu.org
@ 2012-12-06 20:14 ` ubizjak at gmail dot com
  2012-12-06 22:05 ` uros at gcc dot gnu.org
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: ubizjak at gmail dot com @ 2012-12-06 20:14 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #12 from Uros Bizjak <ubizjak at gmail dot com> 2012-12-06 20:14:06 UTC ---
(In reply to comment #11)
 > It works.  Thanks.
> 
> Unfortunately it creates GC garbage often unnecessary, when it won't be used at
> all.

I agree. Let's keep zext together with their users:

--cut here--
Index: i386.c
===================================================================
--- i386.c      (revision 194263)
+++ i386.c      (working copy)
@@ -12785,6 +12785,9 @@
          tp = get_thread_pointer (Pmode, true);
          dest = force_reg (Pmode, gen_rtx_PLUS (Pmode, tp, dest));

+         if (GET_MODE (x) != Pmode)
+           x = gen_rtx_ZERO_EXTEND (Pmode, x);
+
          set_unique_reg_note (get_last_insn (), REG_EQUAL, x);
        }
       else
@@ -12793,15 +12796,20 @@

          if (TARGET_64BIT)
            {
-             rtx rax = gen_rtx_REG (Pmode, AX_REG), insns;
+             rtx rax = gen_rtx_REG (Pmode, AX_REG);
+             rtx insns;

              start_sequence ();
-             emit_call_insn (ix86_gen_tls_global_dynamic_64 (rax, x,
-                                                             caddr));
+             emit_call_insn
+               (ix86_gen_tls_global_dynamic_64 (rax, x, caddr));
              insns = get_insns ();
              end_sequence ();

              RTL_CONST_CALL_P (insns) = 1;
+
+             if (GET_MODE (x) != Pmode)
+               x = gen_rtx_ZERO_EXTEND (Pmode, x);
+
              emit_libcall_block (insns, dest, rax, x);
            }
          else
@@ -12842,11 +12850,12 @@

          if (TARGET_64BIT)
            {
-             rtx rax = gen_rtx_REG (Pmode, AX_REG), insns, eqv;
+             rtx rax = gen_rtx_REG (Pmode, AX_REG);
+             rtx insns, eqv;

              start_sequence ();
-             emit_call_insn (ix86_gen_tls_local_dynamic_base_64 (rax,
-                                                                 caddr));
+             emit_call_insn
+               (ix86_gen_tls_local_dynamic_base_64 (rax, caddr));
              insns = get_insns ();
              end_sequence ();

@@ -12871,6 +12880,9 @@
        {
          dest = force_reg (Pmode, gen_rtx_PLUS (Pmode, dest, tp));

+         if (GET_MODE (x) != Pmode)
+           x = gen_rtx_ZERO_EXTEND (Pmode, x);
+
          set_unique_reg_note (get_last_insn (), REG_EQUAL, x);
        }
       break;
--cut here--


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

* [Bug middle-end/55597] [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88
  2012-12-04 21:01 [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88 hjl.tools at gmail dot com
                   ` (11 preceding siblings ...)
  2012-12-06 20:14 ` ubizjak at gmail dot com
@ 2012-12-06 22:05 ` uros at gcc dot gnu.org
  2012-12-07  3:44 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: uros at gcc dot gnu.org @ 2012-12-06 22:05 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #13 from uros at gcc dot gnu.org 2012-12-06 22:05:25 UTC ---
Author: uros
Date: Thu Dec  6 22:05:21 2012
New Revision: 194274

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194274
Log:
    PR target/55597
    * config/i386/i386.c (legitimize_tls_address): Zero-extend x to Pmode,
    before using it as insn or call equivalent.

testsuite/ChangeLog:

    PR target/55597
    * gcc.target/i386/pr55597.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/i386/pr55597.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug middle-end/55597] [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88
  2012-12-04 21:01 [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88 hjl.tools at gmail dot com
                   ` (12 preceding siblings ...)
  2012-12-06 22:05 ` uros at gcc dot gnu.org
@ 2012-12-07  3:44 ` hjl.tools at gmail dot com
  2012-12-07  8:11 ` uros at gcc dot gnu.org
  2012-12-07  8:21 ` ubizjak at gmail dot com
  15 siblings, 0 replies; 17+ messages in thread
From: hjl.tools at gmail dot com @ 2012-12-07  3:44 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #14 from H.J. Lu <hjl.tools at gmail dot com> 2012-12-07 03:44:21 UTC ---
Fixed.


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

* [Bug middle-end/55597] [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88
  2012-12-04 21:01 [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88 hjl.tools at gmail dot com
                   ` (13 preceding siblings ...)
  2012-12-07  3:44 ` hjl.tools at gmail dot com
@ 2012-12-07  8:11 ` uros at gcc dot gnu.org
  2012-12-07  8:21 ` ubizjak at gmail dot com
  15 siblings, 0 replies; 17+ messages in thread
From: uros at gcc dot gnu.org @ 2012-12-07  8:11 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #15 from uros at gcc dot gnu.org 2012-12-07 08:10:44 UTC ---
Author: uros
Date: Fri Dec  7 08:10:37 2012
New Revision: 194292

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194292
Log:
    Backport from mainline
    2012-12-06  Uros Bizjak  <ubizjak@gmail.com>
            H.J. Lu  <hongjiu.lu@intel.com>

    PR target/55597
    * config/i386/i386.c (legitimize_tls_address): Zero-extend x to Pmode,
    before using it as insn or call equivalent.

testsuite/ChangeLog:

    Backport from mainline
    2012-12-06  Uros Bizjak  <ubizjak@gmail.com>

    PR target/55597
    * gcc.target/i386/pr55597.c: New test.


Added:
    branches/gcc-4_7-branch/gcc/testsuite/gcc.target/i386/pr55597.c
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/config/i386/i386.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug middle-end/55597] [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88
  2012-12-04 21:01 [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88 hjl.tools at gmail dot com
                   ` (14 preceding siblings ...)
  2012-12-07  8:11 ` uros at gcc dot gnu.org
@ 2012-12-07  8:21 ` ubizjak at gmail dot com
  15 siblings, 0 replies; 17+ messages in thread
From: ubizjak at gmail dot com @ 2012-12-07  8:21 UTC (permalink / raw)
  To: gcc-bugs


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

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-p
                   |                            |atches/2012-12/msg00440.htm
                   |                            |l
   Target Milestone|4.8.0                       |4.7.3

--- Comment #16 from Uros Bizjak <ubizjak at gmail dot com> 2012-12-07 08:20:46 UTC ---
.


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

end of thread, other threads:[~2012-12-07  8:21 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-04 21:01 [Bug middle-end/55597] New: [4.8 Regression] internal compiler error: in plus_constant, at explow.c:88 hjl.tools at gmail dot com
2012-12-04 22:29 ` [Bug middle-end/55597] " hjl.tools at gmail dot com
2012-12-04 22:52 ` bonzini at gnu dot org
2012-12-04 23:25 ` [Bug target/55597] " steven at gcc dot gnu.org
2012-12-04 23:46 ` [Bug target/55597] " steven at gcc dot gnu.org
2012-12-04 23:50 ` [Bug middle-end/55597] " hjl.tools at gmail dot com
2012-12-05 11:34 ` [Bug middle-end/55597] [4.8 Regression] " ebotcazou at gcc dot gnu.org
2012-12-05 17:28 ` hjl.tools at gmail dot com
2012-12-05 17:56 ` hjl.tools at gmail dot com
2012-12-05 20:46 ` ubizjak at gmail dot com
2012-12-06  0:22 ` hjl.tools at gmail dot com
2012-12-06 15:05 ` jakub at gcc dot gnu.org
2012-12-06 20:14 ` ubizjak at gmail dot com
2012-12-06 22:05 ` uros at gcc dot gnu.org
2012-12-07  3:44 ` hjl.tools at gmail dot com
2012-12-07  8:11 ` uros at gcc dot gnu.org
2012-12-07  8:21 ` ubizjak at gmail dot com

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).