The m68k port stopped bootstrapping recently because of this error:
In file included from ./tm.h:31,
from ../../../gcc/gcc/target.h:52,
from ../../../gcc/gcc/dwarf2cfi.cc:23:
../../../gcc/gcc/dwarf2cfi.cc: In function 'bool dwarf2out_do_cfi_asm()':
../../../gcc/gcc/config/m68k/m68k.h:780:22: error: use of logical '||' with
constant operand '2' [-Werror=constant-logical-operand]
780 | && ((GLOBAL) || (CODE)))
\
| ~~~~~~~~~^~~~~~~~~
../../../gcc/gcc/dwarf2cfi.cc:3755:9: note: in expansion of macro
'ASM_PREFERRED_EH_DATA_FORMAT'
3755 | enc = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/2,/*global=*/1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../gcc/gcc/config/m68k/m68k.h:780:22: note: use '|' for bitwise operation
../../../gcc/gcc/dwarf2cfi.cc:3755:9: note: in expansion of macro
'ASM_PREFERRED_EH_DATA_FORMAT'
3755 | enc = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/2,/*global=*/1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note the "2" being passed down. That's what triggers the warning. The
semantic preserving change is to use !!CODE. Given the port won't
currently bootstrap, I'm committing as-is.
Jeff
commit f622e152e32c54b9d9cb8e9e5dcbe58385557e14
Author: Jeff Law <[email protected]>
Date: Sat May 30 11:13:18 2026 -0600
Fix m68k bootstrap due to diagnostic
The m68k port stopped bootstrapping recently because of this error:
> In file included from ./tm.h:31,
> from ../../../gcc/gcc/target.h:52,
> from ../../../gcc/gcc/dwarf2cfi.cc:23:
> ../../../gcc/gcc/dwarf2cfi.cc: In function 'bool dwarf2out_do_cfi_asm()':
> ../../../gcc/gcc/config/m68k/m68k.h:780:22: error: use of logical '||'
with constant operand '2' [-Werror=constant-logical-operand]
> 780 | && ((GLOBAL) || (CODE)))
\
> | ~~~~~~~~~^~~~~~~~~
> ../../../gcc/gcc/dwarf2cfi.cc:3755:9: note: in expansion of macro
'ASM_PREFERRED_EH_DATA_FORMAT'
> 3755 | enc = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/2,/*global=*/1);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../../../gcc/gcc/config/m68k/m68k.h:780:22: note: use '|' for bitwise
operation
> ../../../gcc/gcc/dwarf2cfi.cc:3755:9: note: in expansion of macro
'ASM_PREFERRED_EH_DATA_FORMAT'
> 3755 | enc = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/2,/*global=*/1);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note the "2" being passed down. That's what triggers the warning. The
semantic preserving change is to use !!CODE. Given the port won't currently
bootstrap, I'm committing as-is.
gcc/
* config/m68k/m68k.h (ASM_PREFERRED_EH_DATA_FORMAT): Avoid
constant-logical diagnostic.
diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
index 350d1470aa3..da572e89b78 100644
--- a/gcc/config/m68k/m68k.h
+++ b/gcc/config/m68k/m68k.h
@@ -777,7 +777,7 @@ __transfer_from_trampoline ()
\
#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
(flag_pic \
&& !((TARGET_ID_SHARED_LIBRARY || TARGET_SEP_DATA) \
- && ((GLOBAL) || (CODE))) \
+ && ((GLOBAL) || (!!CODE))) \
? ((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4 \
: DW_EH_PE_absptr)