[Bug target/48863] A Bug When Assembler Instructions with C Expression Operands in arm-elf-gcc 4.5

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

Ramana Radhakrishnan  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|7.3 |6.3

--- Comment #10 from Ramana Radhakrishnan  ---
This was really fixed for 6.3 ...

[Bug target/48863] A Bug When Assembler Instructions with C Expression Operands in arm-elf-gcc 4.5

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

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|7.2 |7.3

[Bug target/48863] A Bug When Assembler Instructions with C Expression Operands in arm-elf-gcc 4.5

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

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|7.2 |7.3

--- Comment #10 from Richard Biener  ---
GCC 7.2 is being released, adjusting target milestone.

--- Comment #11 from Richard Biener  ---
GCC 7.2 is being released, adjusting target milestone.

[Bug target/48863] A Bug When Assembler Instructions with C Expression Operands in arm-elf-gcc 4.5

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

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|7.2 |7.3

--- Comment #10 from Richard Biener  ---
GCC 7.2 is being released, adjusting target milestone.

--- Comment #11 from Richard Biener  ---
GCC 7.2 is being released, adjusting target milestone.

[Bug target/48863] A Bug When Assembler Instructions with C Expression Operands in arm-elf-gcc 4.5

2017-05-02 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48863

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|7.0 |7.2

--- Comment #9 from Jakub Jelinek  ---
GCC 7.1 has been released.

[Bug target/48863] A Bug When Assembler Instructions with C Expression Operands in arm-elf-gcc 4.5

2016-12-01 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48863

--- Comment #8 from ktkachov at gcc dot gnu.org ---
Author: ktkachov
Date: Thu Dec  1 13:47:13 2016
New Revision: 243109

URL: https://gcc.gnu.org/viewcvs?rev=243109=gcc=rev
Log:
[TER] PR target/48863: Don't replace expressions across local register variable
definitions

Backport from mainline
2016-11-24  Kyrylo Tkachov  

PR target/48863
PR inline-asm/70184
* tree-ssa-ter.c (temp_expr_table): Add reg_vars_cnt field.
(new_temp_expr_table): Initialise reg_vars_cnt.
(free_temp_expr_table): Release reg_vars_cnt.
(process_replaceable): Add reg_vars_cnt argument, set reg_vars_cnt
field of TAB.
(find_replaceable_in_bb): Use the above to record register variable
write occurrences and cancel replacement across them.

* gcc.target/arm/pr48863.c: New test.


Added:
branches/gcc-6-branch/gcc/testsuite/gcc.target/arm/pr48863.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/testsuite/ChangeLog
branches/gcc-6-branch/gcc/tree-ssa-ter.c

[Bug target/48863] A Bug When Assembler Instructions with C Expression Operands in arm-elf-gcc 4.5

2016-11-24 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48863

ktkachov at gcc dot gnu.org changed:

   What|Removed |Added

 CC||ktkachov at gcc dot gnu.org
  Known to work||7.0
   Target Milestone|--- |7.0

--- Comment #7 from ktkachov at gcc dot gnu.org ---
Fixed on trunk for GCC 7.
I'll wait for a bit before proposing a backport (if this is needed on the
branches)

[Bug target/48863] A Bug When Assembler Instructions with C Expression Operands in arm-elf-gcc 4.5

2016-11-24 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48863

--- Comment #6 from ktkachov at gcc dot gnu.org ---
Author: ktkachov
Date: Thu Nov 24 15:22:34 2016
New Revision: 242840

URL: https://gcc.gnu.org/viewcvs?rev=242840=gcc=rev
Log:
[TER] PR target/48863 : Don't replace expressions across local register
variable definitions

PR target/48863
PR inline-asm/70184
* tree-ssa-ter.c (temp_expr_table): Add reg_vars_cnt field.
(new_temp_expr_table): Initialise reg_vars_cnt.
(free_temp_expr_table): Release reg_vars_cnt.
(process_replaceable): Add reg_vars_cnt argument, set reg_vars_cnt
field of TAB.
(find_replaceable_in_bb): Use the above to record register variable
write occurrences and cancel replacement across them.

* gcc.target/arm/pr48863.c: New test.


Added:
trunk/gcc/testsuite/gcc.target/arm/pr48863.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-ter.c

[Bug target/48863] A Bug When Assembler Instructions with C Expression Operands in arm-elf-gcc 4.5

2016-04-01 Thread ramana at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48863

Ramana Radhakrishnan  changed:

   What|Removed |Added

   Keywords||wrong-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-04-01
 CC||ramana at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #5 from Ramana Radhakrishnan  ---
Well confirmed.

[Bug target/48863] A Bug When Assembler Instructions with C Expression Operands in arm-elf-gcc 4.5

2011-06-19 Thread mikpe at it dot uu.se
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48863

--- Comment #4 from Mikael Pettersson mikpe at it dot uu.se 2011-06-19 
16:26:25 UTC ---
Created attachment 24562
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=24562
runtime test case

Here's a small runtime test case.

 cat pr48863.c
/* pr48863.c */

static inline int dosvc(int fd, unsigned long high, unsigned low)
{
register int r0 asm(r0) = fd;
register int r2 asm(r2) = high;
register int r3 asm(r3) = low;

asm volatile(
 : =r(r0)
 : 0(r0), r(r2), r(r3));
return r0;
}

struct s {
int fd;
long long length;
} s = { 2, 0 }, *p = s;

int main(void)
{
unsigned low = p-length  0x;
unsigned high = p-length / 23;

if (dosvc(p-fd, high, low) != 2)
__builtin_abort();
return 0;
}
 /mnt/scratch/objdir47/gcc/xgcc -B/mnt/scratch/objdir47/gcc/ -O2 pr48863.c ; 
 ./a.out
Abort
 /mnt/scratch/objdir47/gcc/xgcc -B/mnt/scratch/objdir47/gcc/ -O2 -S pr48863.c 
 ; cat pr48863.s
...
main:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
# loads p to r1
ldr r1, .L5
stmfd   sp!, {r4, lr}
# loads *p to r1
ldr r1, [r1, #0]
mov r2, #23
mov r3, #0
ldr r4, [r1, #8]
ldr r1, [r1, #12]
mov r0, r4
bl  __aeabi_ldivmod
mov r3, r4
mov r2, r0

# here's where the SWI would have been, note how:
# 1. p-fd was never loaded into r0
# 2. r0 was clobbered by the libcall to __aeabi_ldivmod

cmp r0, #2

# so this comparison will fail and we'll abort
...

Works when compiled with -O0.


[Bug target/48863] A Bug When Assembler Instructions with C Expression Operands in arm-elf-gcc 4.5

2011-05-09 Thread shangyunhai at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48863

--- Comment #3 from Dillon shangyunhai at gmail dot com 2011-05-10 00:41:40 
UTC ---
*** Bug 48862 has been marked as a duplicate of this bug. ***


[Bug target/48863] A Bug When Assembler Instructions with C Expression Operands in arm-elf-gcc 4.5

2011-05-09 Thread shangyunhai at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48863

--- Comment #2 from Dillon shangyunhai at gmail dot com 2011-05-10 00:40:16 
UTC ---
*** Bug 48861 has been marked as a duplicate of this bug. ***


[Bug target/48863] A Bug When Assembler Instructions with C Expression Operands in arm-elf-gcc 4.5

2011-05-04 Thread mikpe at it dot uu.se
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48863

Mikael Pettersson mikpe at it dot uu.se changed:

   What|Removed |Added

 CC||mikpe at it dot uu.se

--- Comment #1 from Mikael Pettersson mikpe at it dot uu.se 2011-05-04 
08:48:23 UTC ---
I see this on armv5tel-linux-gnueabi too, with the glibc-ports-2.10.1
definition of the syscall wrapper macros.  It seems to be caused by / being
expanded to a libcall by the backend.  If I move the / 23 expression to a
helper function and make that noinline, then the division does occur well
before the swi registers are set up.  Without the noinline a call to
__aeabi_uldivmod occurs just before the swi, clobbering some of its parameters.