public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/101422] New: register variable uninitialised before passing to asm
@ 2021-07-11 18:23 simon.willcocks at gmx dot de
  2021-07-11 18:30 ` [Bug inline-asm/101422] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: simon.willcocks at gmx dot de @ 2021-07-11 18:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101422

            Bug ID: 101422
           Summary: register variable uninitialised before passing to asm
           Product: gcc
           Version: 10.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon.willcocks at gmx dot de
  Target Milestone: ---

Created attachment 51132
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51132&action=edit
Source code fragment

The attached program fragment sets up multiple register variables associated
with specific ARM registers and runs some assembly code that makes use of them.
With -Os (and a generated memset to initialise a local array), some registers
are not correctly initialised, notably r0, which is corrupted by the address of
the array, and r3 which is not initialised at all before the asm instruction.
r4, however, is correctly initialised.

Affects arm-linux-gnueabi-gcc-10, arm-linux-gnueabi-gcc-9, and
arm-linux-gnueabi-gcc-8.

for opt in 1 2 3 4 s ; do for vers in 8 9 10 ; do arm-linux-gnueabi-gcc-$vers
problem.c -S -O$opt -Wall -Wextra -o problem-$vers-$opt.s ; done ; done

To see the problem (the most obvious feature, at least):

for i in problem*.s ; do echo ; echo $i ; grep r3 $i ; done

In all three versions with -Os, the first mention of r3 is the asm code.

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

end of thread, other threads:[~2021-07-15 11:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-11 18:23 [Bug c/101422] New: register variable uninitialised before passing to asm simon.willcocks at gmx dot de
2021-07-11 18:30 ` [Bug inline-asm/101422] " pinskia at gcc dot gnu.org
2021-07-11 18:51 ` simon.willcocks at gmx dot de
2021-07-11 18:52 ` simon.willcocks at gmx dot de
2021-07-11 18:59 ` pinskia at gcc dot gnu.org
2021-07-11 19:13 ` simon.willcocks at gmx dot de
2021-07-12  8:14 ` jakub at gcc dot gnu.org
2021-07-12 13:02 ` simon.willcocks at gmx dot de
2021-07-15 11:41 ` simon.willcocks at gmx dot de

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