[Bug middle-end/80295] [7/8 Regression] ICE in __builtin_update_setjmp_buf expander

2017-10-17 Thread paolo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80295

--- Comment #12 from paolo at gcc dot gnu.org  ---
Author: paolo
Date: Tue Oct 17 14:17:17 2017
New Revision: 253815

URL: https://gcc.gnu.org/viewcvs?rev=253815&root=gcc&view=rev
Log:
gcc/ChangeLog

2017-10-17  Qing Zhao 
Wilco Dijkstra 

* builtins.c (expand_builtin_update_setjmp_buf): Add a
converstion to Pmode from the buf_addr.

gcc/testsuite/ChangeLog

2017-10-17  Qing Zhao 
Wilco Dijkstra 

PR middle-end/80295
* gcc.target/aarch64/pr80295.c: New test.

Modified:
trunk/gcc/testsuite/ChangeLog

[Bug middle-end/80295] [7/8 Regression] ICE in __builtin_update_setjmp_buf expander

2017-10-17 Thread paolo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80295

--- Comment #11 from paolo at gcc dot gnu.org  ---
Author: paolo
Date: Tue Oct 17 14:16:35 2017
New Revision: 253814

URL: https://gcc.gnu.org/viewcvs?rev=253814&root=gcc&view=rev
Log:
gcc/ChangeLog

2017-10-17  Qing Zhao 
Wilco Dijkstra 

* builtins.c (expand_builtin_update_setjmp_buf): Add a
converstion to Pmode from the buf_addr.

gcc/testsuite/ChangeLog

2017-10-17  Qing Zhao 
Wilco Dijkstra 

PR middle-end/80295
* gcc.target/aarch64/pr80295.c: New test.

Added:
trunk/gcc/testsuite/gcc.target/aarch64/pr80295.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c

[Bug middle-end/80295] [7/8 Regression] ICE in __builtin_update_setjmp_buf expander

2017-10-06 Thread qing.zhao at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80295

--- Comment #10 from Qing Zhao  ---
Comment on attachment 42319
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42319
proposed patch

The implementation of __builtin_update_setjmp_buf is incorrect. It takes a
pointer
as an operand and treats the Mode of the pointer as Pmode, which is not
correct.

a conversion from ptr_mode to Pmode is needed.

[Bug middle-end/80295] [7/8 Regression] ICE in __builtin_update_setjmp_buf expander

2017-10-06 Thread qing.zhao at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80295

--- Comment #9 from Qing Zhao  ---
Created attachment 42319
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42319&action=edit
proposed patch

[Bug middle-end/80295] [7/8 Regression] ICE in __builtin_update_setjmp_buf expander

2017-10-06 Thread wilco at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80295

--- Comment #8 from Wilco  ---
(In reply to Qing Zhao from comment #7)

> However, I am still not very sure about the current implementation of
> -mabi=ilp32 on aarch64
> for example:
> 
> qinzhao@gcc116:~/Bugs/80295$ cat t1.c
> void f (void *b) { __builtin_return(b); }
> qinzhao@gcc116:~/Bugs/80295$ sh t1
> /home/qinzhao/Install/latest/bin/gcc -mabi=ilp32 -fdump-rtl-all
> -fdump-tree-all t1.c
> 
> in t1.c.231r.expand, I see the following stack pushing RTL insn:
> 
> (insn 2 4 3 2 (set (mem/f/c:SI (plus:DI (reg/f:DI 68 virtual-stack-vars)
> (const_int -4 [0xfffc])) [1 b+0 S4 A32])
> (reg:SI 0 x0 [ b ])) "t1.c":1 -1
>  (nil))
> 
> the above looks like that ilp32 treats the stack pushing as 32 bit (not 64
> bits as aarch64 LP64 mode).
> is this right?

You're compiling without optimization, so the above instruction is spilling b
to the stack (not a push, just a store - there are no callee-saves for this
function). And b is SImode in ILP32, so it's correct.

[Bug middle-end/80295] [7/8 Regression] ICE in __builtin_update_setjmp_buf expander

2017-10-06 Thread qing.zhao at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80295

--- Comment #7 from Qing Zhao  ---
thank you, Wilco.
> Wilco  changed:
> 
>   What|Removed |Added
> 
> CC||wilco at gcc dot gnu.org
> 
> --- Comment #6 from Wilco  ---
> The implementation of __builtin_update_setjmp_buf is incorrect, it takes a
> pointer (ie. SImode in ILP32) and treats the result of the add as Pmode
> (DImode). So it's missing a cast to Pmode.

Yes, this was what I thought too after more study.

However, I am still not very sure about the current implementation of
-mabi=ilp32 on aarch64
for example:

qinzhao@gcc116:~/Bugs/80295$ cat t1.c
void f (void *b) { __builtin_return(b); }
qinzhao@gcc116:~/Bugs/80295$ sh t1
/home/qinzhao/Install/latest/bin/gcc -mabi=ilp32 -fdump-rtl-all -fdump-tree-all
t1.c

in t1.c.231r.expand, I see the following stack pushing RTL insn:

(insn 2 4 3 2 (set (mem/f/c:SI (plus:DI (reg/f:DI 68 virtual-stack-vars)
(const_int -4 [0xfffc])) [1 b+0 S4 A32])
(reg:SI 0 x0 [ b ])) "t1.c":1 -1
 (nil))

the above looks like that ilp32 treats the stack pushing as 32 bit (not 64 bits
as aarch64 LP64 mode).
is this right?

[Bug middle-end/80295] [7/8 Regression] ICE in __builtin_update_setjmp_buf expander

2017-10-06 Thread wilco at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80295

Wilco  changed:

   What|Removed |Added

 CC||wilco at gcc dot gnu.org

--- Comment #6 from Wilco  ---
The implementation of __builtin_update_setjmp_buf is incorrect, it takes a
pointer (ie. SImode in ILP32) and treats the result of the add as Pmode
(DImode). So it's missing a cast to Pmode.

[Bug middle-end/80295] [7/8 Regression] ICE in __builtin_update_setjmp_buf expander

2017-09-19 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80295

Paolo Carlini  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |qing.zhao at oracle dot 
com

--- Comment #5 from Paolo Carlini  ---
Working on it.

[Bug middle-end/80295] [7/8 Regression] ICE in __builtin_update_setjmp_buf expander

2017-09-19 Thread qing.zhao at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80295

--- Comment #4 from Qing Zhao  ---
working on a fix to this bug.
let me know if you are working on it too.

[Bug middle-end/80295] [7/8 Regression] ICE in __builtin_update_setjmp_buf expander

2017-09-18 Thread qing.zhao at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80295

Qing Zhao  changed:

   What|Removed |Added

 CC||qing.zhao at oracle dot com

--- Comment #3 from Qing Zhao  ---
confirmed with the latest upstream GCC. 
-mabi=ilp32 triggers the failure.

[Bug middle-end/80295] [7/8 Regression] ICE in __builtin_update_setjmp_buf expander

2017-08-16 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80295

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2
   Target Milestone|--- |7.3

[Bug middle-end/80295] [7/8 Regression] ICE in __builtin_update_setjmp_buf expander

2017-08-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80295

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |7.3

[Bug middle-end/80295] [7/8 Regression] ICE in __builtin_update_setjmp_buf expander

2017-08-09 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80295

--- Comment #2 from Andreas Schwab  ---
No, it doesn't.  It only made it possible to call the builtin from the
frontend.

[Bug middle-end/80295] [7/8 Regression] ICE in __builtin_update_setjmp_buf expander

2017-08-09 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80295

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-08-09
 CC||marxin at gcc dot gnu.org
  Known to work||6.4.0
Summary|ICE in  |[7/8 Regression] ICE in
   |__builtin_update_setjmp_buf |__builtin_update_setjmp_buf
   |expander|expander
 Ever confirmed|0   |1
  Known to fail||7.1.0, 8.0

--- Comment #1 from Martin Liška  ---
Confirmed. Started with your commit r246720.