On Fri, 2024-02-02 at 10:42 +0800, chenglulu wrote:
> LGTM!
> 
> Thanks!

Pushed r14-8773.

> 在 2024/2/2 上午5:54, Xi Ruoyao 写道:
> > When bootstrapping GCC 14 --with-build-config=bootstrap-lto, an ODR
> > violation is detected:
> > 
> >      ../../gcc/config/loongarch/loongarch-opts.cc:57: warning:
> >      'abi_minimal_isa' violates the C++ One Definition Rule [-Wodr]
> >      57 | abi_minimal_isa[N_ABI_BASE_TYPES][N_ABI_EXT_TYPES];
> >      ../../gcc/config/loongarch/loongarch-def.cc:186: note:
> >      'abi_minimal_isa' was previously declared here
> >      186 |   abi_minimal_isa = array<array<loongarch_isa, N_ABI_EXT_TYPES>,
> >      ../../gcc/config/loongarch/loongarch-def.cc:186: note:
> >      code may be misoptimized unless '-fno-strict-aliasing' is used
> > 
> > Fix it by adding a proper declaration of abi_minimal_isa into
> > loongarch-def.h and remove the ODR-violating local declaration in
> > loongarch-opts.cc.
> > 
> > gcc/ChangeLog:
> > 
> >     * config/loongarch/loongarch-def.h (abi_minimal_isa): Declare.
> >     * config/loongarch/loongarch-opts.cc (abi_minimal_isa): Remove
> >     the ODR-violating locale declaration.
> > ---
> > 
> > Bootstrapped on loongarch64-linux-gnu.  Not fully regtested but it
> > should be an obvious fix.  Ok for trunk?
> > 
> >   gcc/config/loongarch/loongarch-def.h   | 3 +++
> >   gcc/config/loongarch/loongarch-opts.cc | 2 --
> >   2 files changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/gcc/config/loongarch/loongarch-def.h 
> > b/gcc/config/loongarch/loongarch-def.h
> > index a1237ecf1fd..2dbf006d013 100644
> > --- a/gcc/config/loongarch/loongarch-def.h
> > +++ b/gcc/config/loongarch/loongarch-def.h
> > @@ -203,5 +203,8 @@ extern loongarch_def_array<loongarch_align, 
> > N_TUNE_TYPES>
> >     loongarch_cpu_align;
> >   extern loongarch_def_array<loongarch_rtx_cost_data, N_TUNE_TYPES>
> >     loongarch_cpu_rtx_cost_data;
> > +extern loongarch_def_array<
> > +  loongarch_def_array<loongarch_isa, N_ABI_EXT_TYPES>,
> > +  N_ABI_BASE_TYPES> abi_minimal_isa;
> >   
> >   #endif /* LOONGARCH_DEF_H */
> > diff --git a/gcc/config/loongarch/loongarch-opts.cc 
> > b/gcc/config/loongarch/loongarch-opts.cc
> > index b87299513c9..7eeac43ed2f 100644
> > --- a/gcc/config/loongarch/loongarch-opts.cc
> > +++ b/gcc/config/loongarch/loongarch-opts.cc
> > @@ -53,8 +53,6 @@ static const int tm_multilib_list[] = { TM_MULTILIB_LIST 
> > };
> >   static int enabled_abi_types[N_ABI_BASE_TYPES][N_ABI_EXT_TYPES] = { 0 };
> >   
> >   #define isa_required(ABI) (abi_minimal_isa[(ABI).base][(ABI).ext])
> > -extern "C" const struct loongarch_isa
> > -abi_minimal_isa[N_ABI_BASE_TYPES][N_ABI_EXT_TYPES];
> >   
> >   static inline int
> >   is_multilib_enabled (struct loongarch_abi abi)
> 

-- 
Xi Ruoyao <xry...@xry111.site>
School of Aerospace Science and Technology, Xidian University

Reply via email to