This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/24414] New: Old-style asms don't clobber memory
- From: "rth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Oct 2005 20:17:11 -0000
- Subject: [Bug rtl-optimization/24414] New: Old-style asms don't clobber memory
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
#include <signal.h>
#include <unistd.h>
int test;
void handler (int sig)
{
test = 1;
}
int main()
{
signal (SIGALRM, handler);
alarm (1);
while (test == 0)
asm("");
return 0;
}
Results in an infinite loop with -O2. The load of test in main should not
be hoisted out of the loop. A more x86-specific example (but without relying
on unix syscalls might be
int test;
int main()
{
int x = test;
asm("movl $1,test");
if (x + test != 1)
__builtin_trap ();
return 0;
}
It also wouldn't surprise me if the two tests have different culprits...
--
Summary: Old-style asms don't clobber memory
Product: gcc
Version: 4.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24414