This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Multiple set insns reload problem.


> > int a;
> > main()
> > {
> >   int *ptr=&a;
> >   asm("":"=r"(ptr):"0"(&a));  /* Hide the constant address behind cse */
> >   asm("movl $0,%0 ; movl $0,%1":"=m,r"(*ptr),"=,c"(ptr));
> 
> I think you invoke undefined behaviour here, because you are updating
> ptr in the same insn as you use it as address in a separate upadte, and
> there is no sequence point between the updates.
OK
If this is expected to be undefined so there is probably no problem.
But is this mentioned somewhere in the documentation?
I can't find it in the asm statements section where it IMO ought to
be mentioned.
I believe that such situation may happen with real inline functions
unsing asm statements if you pass clever parameters to it.

Honza

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]