Created attachment 28130 [details] preprocessed source seen with 4.6, 4,7 and trunk, on arm-linux-gnueabihf works with -O2, fails with -O3 $ /usr/lib/gcc-snapshot/bin/gcc -c -mfloat-abi=hard -fno-strict-aliasing -g -O3 -fvisibility=hidden -fvisibility-inlines-hidden -fPIC FastMalloc.ii /tmp/ccMcdYyn.s: Assembler messages: /tmp/ccMcdYyn.s:3705: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:3708: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:4075: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:4078: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:4578: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:4581: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:5282: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:5285: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:6860: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:6863: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:7427: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:7430: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:9073: Error: bad immediate value for offset (-8) /tmp/ccMcdYyn.s:9076: Error: bad immediate value for offset (-8) /tmp/ccMcdYyn.s:9251: Error: bad immediate value for offset (-8) /tmp/ccMcdYyn.s:9254: Error: bad immediate value for offset (-8) /tmp/ccMcdYyn.s:10261: Error: bad immediate value for offset (-8) /tmp/ccMcdYyn.s:10264: Error: bad immediate value for offset (-8) /tmp/ccMcdYyn.s:10431: Error: bad immediate value for offset (-8) /tmp/ccMcdYyn.s:10434: Error: bad immediate value for offset (-8) /tmp/ccMcdYyn.s:10534: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:10537: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:10614: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:10617: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:12008: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:12011: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:12135: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:12138: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:12522: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:12525: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:12702: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:12705: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:13265: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:13268: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:13547: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:13550: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:14840: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:14843: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:15097: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:15100: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:16386: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:16389: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:16809: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:16812: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:19119: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:19122: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:19377: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:19380: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:20614: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:20617: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:20870: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:20873: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:22513: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:22516: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:23218: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:23221: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:23359: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:23362: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:25316: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:25319: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:26032: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:26035: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:26326: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:26329: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:28551: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:28554: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:28905: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:28908: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:29229: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:29232: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:29728: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:29731: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:31204: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:31207: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:32296: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:32299: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:35133: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:35136: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:35721: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:35724: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:36130: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:36133: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:36548: Error: bad immediate value for offset (3424) /tmp/ccMcdYyn.s:36551: Error: bad immediate value for offset (3424) gcc-4.7 shows the same amount of errors, while gcc-4.6 only shows: $ gcc-4.6 -c -mfloat-abi=hard -fno-strict-aliasing -g -O3 -fvisibility=hidden -fvisibility-inlines-hidden -fPIC FastMalloc.ii /tmp/ccjLa81C.s: Assembler messages: /tmp/ccjLa81C.s:8779: Error: bad immediate value for offset (-16) /tmp/ccjLa81C.s:8782: Error: bad immediate value for offset (-16) /tmp/ccjLa81C.s:8805: Error: bad immediate value for offset (-16) /tmp/ccjLa81C.s:8808: Error: bad immediate value for offset (-16)
Problem is because the input is invalid . We just end up generating ldrex r0, [r1, #-24] . asm volatile( "movw %1, #1\n\t" "ldrex %2, %0\n\t" "cmp %3, %2\n\t" "bne.n 0f\n\t" "strex %1, %4, %0\n\t" "0:" : "+m"(*location), "=&r"(result), "=&r"(tmp) : "r"(expected), "r"(newValue) : "memory"); Eh - you can't use m for a constraint to an address in ldrex . Try "+Q" instead. regards, Ramana