[Bug target/125728] M68k: m68k-elf-gcc generates code that raises address error exception in certain circumstances

mikpelinux at gmail dot com via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125728

--- Comment #2 from Mikael Pettersson <mikpelinux at gmail dot com> ---
The difference is first seen in .305r.late_combine1:

-(insn 6 5 7 2 (set (reg:QI 37 [ _5 ])
-        (and:QI (mem/c:QI (symbol_ref:SI ("foo") [flags 0x2]  <var_decl
0x7fbbc7478980 foo>) [0 foo+0 S1 A16])
-            (const_int 7 [0x7]))) "/tmp/pr125728.c":6:20 251 {andqi3}
+(insn 7 5 8 2 (set (reg:SI 38 [ _2 ])
+        (and:SI (mem/c:SI (const:SI (plus:SI (symbol_ref:SI ("foo") [flags
0x2]  <var_decl 0x7fcd5e89b980 foo>)
+                        (const_int -3 [0xfffffffffffffffd]))) [0 foo+-3 S4
A8])
+            (const_int 7 [0x7]))) "/tmp/pr125728.c":6:20 246 {andsi3_internal}
      (nil))
-(insn 7 6 8 2 (set (reg:SI 38 [ _2 ])
-        (zero_extend:SI (reg:QI 37 [ _5 ]))) "/tmp/pr125728.c":6:20 90
{zero_extendqisi2}
-     (expr_list:REG_DEAD (reg:QI 37 [ _5 ])
-        (nil)))

That (mem:SI (const:SI (plus:SI (symbol_ref:SI ("foo")) (const_int -3)))) is
clearly invalid on a strict-alignment target.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.