Bug 28140 - asm gets lost between 125r.cse2 and 126r.life1
Summary: asm gets lost between 125r.cse2 and 126r.life1
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2006-06-22 19:41 UTC by Jorn Wolfgang Rennecke
Modified: 2006-06-22 21:22 UTC (History)
1 user (show)

See Also:
Host:
Target: sh-elf
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
test case (532 bytes, text/plain)
2006-06-22 19:43 UTC, Jorn Wolfgang Rennecke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jorn Wolfgang Rennecke 2006-06-22 19:41:56 UTC
An asm statement with side effects gets lost when compiling with O1 or higher.
Comment 1 Jorn Wolfgang Rennecke 2006-06-22 19:43:57 UTC
Created attachment 11731 [details]
test case

This test case should fail to assemble.  Yet it does at -O1 or higher.
Comment 2 Andrew Pinski 2006-06-22 20:56:11 UTC
      __asm__ ("choke_me %0 %1 %2" : "+m" (*p1), "+m" (*p2), "+m" (*p3));
      *p1 = val0;
      *p2 = val0;
      *p3 = val0;

Actually I don't think so since the asm is dead code as the stores to *p1, *p2, and *p3 are dead by the next couple of statements.
Comment 3 Jorn Wolfgang Rennecke 2006-06-22 21:22:14 UTC
(In reply to comment #2)
>       __asm__ ("choke_me %0 %1 %2" : "+m" (*p1), "+m" (*p2), "+m" (*p3));
>       *p1 = val0;
>       *p2 = val0;
>       *p3 = val0;
> 
> Actually I don't think so since the asm is dead code as the stores to *p1, *p2,
> and *p3 are dead by the next couple of statements.
Hmm, that's true.