Bug 130500 - [ARM64] GCC generates wrong code with -O2 flag in WTF::weakCompareAndSwap
Summary: [ARM64] GCC generates wrong code with -O2 flag in WTF::weakCompareAndSwap
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 108645 130506
  Show dependency treegraph
 
Reported: 2014-03-20 02:28 PDT by Gabor Rapcsanyi
Modified: 2015-06-15 06:08 PDT (History)
7 users (show)

See Also:


Attachments
proposed fix (1.85 KB, patch)
2014-03-20 02:38 PDT, Gabor Rapcsanyi
no flags Details | Formatted Diff | Diff
proposed patch v2 (1.94 KB, patch)
2014-03-25 02:50 PDT, Gabor Rapcsanyi
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Rapcsanyi 2014-03-20 02:28:12 PDT
/tmp/cc2M6EGp.s:23: Error: the optional immediate offset can only be 0 at operand 2 -- `ldxr w3,[x29,28]'
/tmp/cc2M6EGp.s:26: Error: the optional immediate offset can only be 0 at operand 3 -- `stxr w2,w1,[x29,28]'
Comment 1 Gabor Rapcsanyi 2014-03-20 02:37:55 PDT
Tried with: 
 gcc-linaro 4.8 (Aarch64)	4.8-2014.02	14.02

(http://www.linaro.org/downloads/)
Comment 2 Gabor Rapcsanyi 2014-03-20 02:38:35 PDT
Created attachment 227276 [details]
proposed fix
Comment 3 WebKit Commit Bot 2014-03-20 02:40:21 PDT
Attachment 227276 [details] did not pass style-queue:


ERROR: Source/WTF/wtf/Atomics.h:125:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:125:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:125:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:125:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:125:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:125:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:165:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:165:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:165:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:165:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
Total errors found: 10 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Zoltan Herczeg 2014-03-24 01:38:52 PDT
This refactor is also ok. I think all of these patches can be landed, if nobody has an objection.
Comment 5 Filip Pizlo 2014-03-24 07:52:05 PDT
Comment on attachment 227276 [details]
proposed fix

Since the new constraints are incorrect and are just there to appease gcc, I would put them behind some #if's and keep the original code around. My recollection is that not using +m in a cas can also lead to code gen bugs in some compilers because the "memory" constraint isn't enough to make them see what's going on.
Comment 6 Gabor Rapcsanyi 2014-03-25 02:50:24 PDT
Created attachment 227731 [details]
proposed patch v2

I put the changes between GCC guards.
Comment 7 WebKit Commit Bot 2014-03-25 02:53:22 PDT
Attachment 227731 [details] did not pass style-queue:


ERROR: Source/WTF/wtf/Atomics.h:125:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:126:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:125:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:126:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:125:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:126:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:125:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:126:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:125:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:126:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:125:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:126:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:126:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:179:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:180:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:179:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:180:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:179:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:180:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:179:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:180:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:180:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
Total errors found: 22 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 WebKit Commit Bot 2014-03-25 07:13:34 PDT
Comment on attachment 227731 [details]
proposed patch v2

Clearing flags on attachment: 227731

Committed r166234: <http://trac.webkit.org/changeset/166234>
Comment 9 WebKit Commit Bot 2014-03-25 07:13:38 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Andreas Schwab 2015-06-15 06:08:23 PDT
The correct constraint is "Q".