https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119214
Bug ID: 119214
Summary: debug volatile asm breaks assembling
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: cobol
Assignee: unassigned at gcc dot gnu.org
Reporter: rguenth at gcc dot gnu.org
Target Milestone: ---
compiling
IDENTIFICATION DIVISION.
PROGRAM-ID. pass.
ENVIRONMENT DIVISION.
PROCEDURE DIVISION.
STOP RUN.
with -O -ftracer results in
pass.cob: Assembler messages:
pass.cob:5: Error: symbol `_procret.65' is already defined
this is because the tracer pass duplicates a
__asm__ __volatile__("_procret.65:");
stmt:
@@ -214,8 +425,14 @@
__asm__ __volatile__("_para._implicit_paragraph_3..pass.0.65:");
__gg__nop = 109;
__gg__variables_to_init (&..variables_to_init_62, 0B);
+ __asm__ __volatile__("_procret.65:");
+ __gg__exit_address.13_83 = __gg__exit_address;
+ if (__gg__exit_address.13_83 == &<L18>)
+ goto <bb 15>; [17.43%]
+ else
+ goto <bb 16>; [82.57%]
- <bb 14> [local count: 429281985]:
+ <bb 14> [local count: 214640993]:
<L18>:
__asm__ __volatile__("_procret.65:");
__gg__exit_address.13_9 = __gg__exit_address;
this also shows the pattern
<L18>:
__asm__ __volatile__("_procret.65:");
__gg__exit_address.13_9 = __gg__exit_address;
if (__gg__exit_address.13_9 == &<L18>)
where label addresses are used. This will be a bit fragile since the
position of labels vs. other stmts isn't preserved. Possibly the addresses
are just IDs, so maybe IDs should be used instead.
The volatile asms will confuse quite some optimization passes - at least for
this particular testcase they seem useless and for debugging only?
The label format needs to adhere to assembler restrictions otherwise,
use the ASM_GENERATE_INTERNAL_LABEL output macro for this.