bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/30758] ODR violations in opcodes dir


From: vries at gcc dot gnu.org
Subject: [Bug binutils/30758] ODR violations in opcodes dir
Date: Thu, 17 Aug 2023 10:45:16 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=30758

--- Comment #7 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #6)
> ...
> diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
> index fc786f09e44..8de2c588bad 100644
> --- a/gdb/mep-tdep.c
> +++ b/gdb/mep-tdep.c
> @@ -48,8 +48,10 @@
>  
>  /* Get the user's customized MeP coprocessor register names from
>     libopcodes.  */
> +namespace {
>  #include "opcodes/mep-desc.h"
>  #include "opcodes/mep-opc.h"
> +}
>  
>  
> 
>  /* The gdbarch_tdep structure.  */
> diff --git a/gdb/or1k-tdep.h b/gdb/or1k-tdep.h
> index a11950584d7..b6ec91ab38e 100644
> --- a/gdb/or1k-tdep.h
> +++ b/gdb/or1k-tdep.h
> @@ -23,8 +23,10 @@
>  #define TARGET_OR1K
>  #endif
>  
> +namespace {
>  #include "opcodes/or1k-desc.h"
>  #include "opcodes/or1k-opc.h"
> +}
>  
>  /* General Purpose Registers */
>  #define OR1K_ZERO_REGNUM          0
> ...

Hmm, that build ok with gcc 7.5.0, but when trying again with gcc 12.3.0, I
get:
...
opcodes/mep-opc.h:59: warning: type of 'mep_config_map' does not match original
declaration [-Wlto-type-mismatch]
   59 | extern mep_config_map_struct mep_config_map[];
      |
opcodes/mep-opc.h:57: note: type 'struct mep_config_map_struct' defined in
anonymous namespace cannot match type 'struct mep_config_map_struct' across the
translation unit boundary
   57 | } mep_config_map_struct;
      |
opcodes/mep-opc.c:92: note: the incompatible type defined in another
translation unit
   92 | mep_config_map_struct mep_config_map[] =
      |
opcodes/mep-opc.c:92: note: 'mep_config_map' was previously declared here
opcodes/mep-opc.c:92: note: code may be misoptimized unless
'-fno-strict-aliasing' is used
...

Now also mep-opc.c is involved.

I'm not sure if the warning makes sense, but I imagine doing the unnamed
namespace trick in the opcodes headers alongside the extern "C" stuff would fix
this.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]