This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/38941] CX isn't preserved with shift
- From: "pinskia at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Jan 2009 04:24:49 -0000
- Subject: [Bug target/38941] CX isn't preserved with shift
- References: <bug-38941-682@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from pinskia at gmail dot com 2009-01-23 04:24 -------
Subject: Re: New: CX isn't preserved with shift
Sent from my iPhone
On Jan 22, 2009, at 5:54 PM, "hjl dot tools at gmail dot com"
<gcc-bugzilla@gcc.gnu.org
> wrote:
> On x86, CX is used for shift. If CX is used for a variable, it
> may not be preserved with shift:
>
> [hjl@gnu-9 reg-1]$ cat r.c
> extern void abort (void);
>
> void
> foo (int x)
> {
> if (x != 8)
> abort ();
> }
>
> void
> bar (int g)
> {
> register int x __asm__("ecx");
> x = 5;
> foo (1 << g);
I think this code is undefined as the register variable is not used in
an inline-asm.
>
> if (x != 5)
> abort ();
> }
>
> int
> main ()
> {
> bar (3);
> return 0;
> }
> [hjl@gnu-9 reg-1]$ make r0
> /export/build/gnu/gcc/build-i686-linux/gcc/xgcc
> -B/export/build/gnu/gcc/build-i686-linux/gcc/ -m32 -O0 r.c -o r0
> [hjl@gnu-9 reg-1]$ ./r0
> Aborted
> [hjl@gnu-9 reg-1]$
>
>
> --
> Summary: CX isn't preserved with shift
> Product: gcc
> Version: 4.4.0
> Status: UNCONFIRMED
> Keywords: ra
> Severity: normal
> Priority: P3
> Component: target
> AssignedTo: unassigned at gcc dot gnu dot org
> ReportedBy: hjl dot tools at gmail dot com
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38941
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38941