Re: [PATCH] [X86_64]: Enable support for next generation AMD Zen5 CPU with znver5 scheduler Model

2024-02-11 Thread Richard Biener
On Sat, Feb 10, 2024 at 1:55 PM Anbazhagan, Karthiban
 wrote:
>
> [Public]
>
>
> Hi all,
>
>
>
> PFA, the patch that enables support for the next generation AMD Zen5 CPU via 
> -march=znver5 with basic znver5 scheduler Model.
>
> We may update the scheduler model going forward.
>
>
>
> Good for trunk?

I'll note that gmail flagged this as spam, in case there's no response
from maintainers
I suggest to re-send.

The patch itself looks straight forward, I'll leave review to Honza/Uros though.

I'll note we have around eight processor_type left before eventually overflowing
the m_PROCESSOR mask ...

Thanks,
Richard.

> Thanks and Regards
>
> Karthiban
>
>
>
>
>
> Resending the patch, as unable to inline the patch here.
>
> reason : awaits moderator approval
>
> Message body is too big: 601858 bytes with a limit of 400 KB
>
>


[PATCH] c++: Fix error recovery when redeclaring enum in different module [PR99573]

2024-02-11 Thread Nathaniel Shead
Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk?

-- >8 --

This ensures that with modules enabled, redeclaring an enum in the wrong
module or with the wrong underlying type no longer ICEs.

The patch also rearranges the order of the checks a little because I
think it's probably more important to note that you can't redeclare the
enum all before complaining about mismatched underlying types etc.

As a drive by this patch also adds some missing diagnostic groups, and
rewords the module redeclaration error message to more closely match the
wording used in other places this check is done.

PR c++/99573

gcc/cp/ChangeLog:

* decl.cc (start_enum): Reorder check for redeclaring in module.
Add missing auto_diagnostic_groups.

gcc/testsuite/ChangeLog:

* g++.dg/modules/enum-12.C: New test.

Signed-off-by: Nathaniel Shead 
---
 gcc/cp/decl.cc | 31 +++---
 gcc/testsuite/g++.dg/modules/enum-12.C | 10 +
 2 files changed, 28 insertions(+), 13 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/modules/enum-12.C

diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 3e41fd4fa31..f982b5f88de 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -16951,12 +16951,28 @@ start_enum (tree name, tree enumtype, tree 
underlying_type,
 /*tag_scope=*/TAG_how::CURRENT_ONLY,
 /*template_header_p=*/false);
 
+  /* Attempt to set the declaring module.  */
+  if (modules_p () && enumtype && TREE_CODE (enumtype) == ENUMERAL_TYPE)
+{
+  tree decl = TYPE_NAME (enumtype);
+  if (!module_may_redeclare (decl))
+   {
+ auto_diagnostic_group d;
+ error ("cannot declare %qD in different module", decl);
+ inform (DECL_SOURCE_LOCATION (decl), "previously declared here");
+ enumtype = error_mark_node;
+   }
+  else
+   set_instantiating_module (decl);
+}
+
   /* In case of a template_decl, the only check that should be deferred
  to instantiation time is the comparison of underlying types.  */
   if (enumtype && TREE_CODE (enumtype) == ENUMERAL_TYPE)
 {
   if (scoped_enum_p != SCOPED_ENUM_P (enumtype))
{
+ auto_diagnostic_group d;
  error_at (input_location, "scoped/unscoped mismatch "
"in enum %q#T", enumtype);
  inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)),
@@ -16965,6 +16981,7 @@ start_enum (tree name, tree enumtype, tree 
underlying_type,
}
   else if (ENUM_FIXED_UNDERLYING_TYPE_P (enumtype) != !! underlying_type)
{
+ auto_diagnostic_group d;
  error_at (input_location, "underlying type mismatch "
"in enum %q#T", enumtype);
  inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)),
@@ -16975,25 +16992,13 @@ start_enum (tree name, tree enumtype, tree 
underlying_type,
   && !same_type_p (underlying_type,
ENUM_UNDERLYING_TYPE (enumtype)))
{
+ auto_diagnostic_group d;
  error_at (input_location, "different underlying type "
"in enum %q#T", enumtype);
  inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)),
  "previous definition here");
  underlying_type = NULL_TREE;
}
-
-  if (modules_p ())
-   {
- if (!module_may_redeclare (TYPE_NAME (enumtype)))
-   {
- error ("cannot define %qD in different module",
-TYPE_NAME (enumtype));
- inform (DECL_SOURCE_LOCATION (TYPE_NAME (enumtype)),
- "declared here");
- enumtype = error_mark_node;
-   }
- set_instantiating_module (TYPE_NAME (enumtype));
-   }
 }
 
   if (!enumtype || TREE_CODE (enumtype) != ENUMERAL_TYPE
diff --git a/gcc/testsuite/g++.dg/modules/enum-12.C 
b/gcc/testsuite/g++.dg/modules/enum-12.C
new file mode 100644
index 000..57eeb85d92a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/enum-12.C
@@ -0,0 +1,10 @@
+// PR c++/99573
+// { dg-additional-options "-fmodules-ts" }
+// { dg-module-cmi !foo }
+
+export module foo;
+namespace std {
+  enum class align_val_t : decltype(sizeof(int)) {};  // { dg-error "different 
module" }
+}
+
+// { dg-prune-output "not writing module" }
-- 
2.43.0



[PATCH] aarch64: Improve PERM<{0}, a, ...> (64bit) by adding whole vector shift right [PR113872]

2024-02-11 Thread Andrew Pinski
The backend currently defines a whole vector shift left for 64bit vectors, 
adding the
shift right can also improve code for some PERMs too. So this adds that pattern.

I added a testcase for the shift left also. I also fixed the instruction 
template
there which was using a space instead of a tab after the instruction.

Built and tested on aarch64-linux-gnu.

PR target/113872

gcc/ChangeLog:

* config/aarch64/aarch64-simd.md (vec_shr_): Use 
tab instead of space after
the instruction in the template.
(vec_shl_): New pattern
* config/aarch64/iterators.md (unspec): Add UNSPEC_VEC_SHL

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/perm_zero-1.c: New test.
* gcc.target/aarch64/perm_zero-2.c: New test.

Signed-off-by: Andrew Pinski 
---
 gcc/config/aarch64/aarch64-simd.md | 18 --
 gcc/config/aarch64/iterators.md|  1 +
 gcc/testsuite/gcc.target/aarch64/perm_zero-1.c | 15 +++
 gcc/testsuite/gcc.target/aarch64/perm_zero-2.c | 15 +++
 4 files changed, 47 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/aarch64/perm_zero-1.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/perm_zero-2.c

diff --git a/gcc/config/aarch64/aarch64-simd.md 
b/gcc/config/aarch64/aarch64-simd.md
index f8bb973a278..0d2f1ea3902 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -1592,9 +1592,23 @@ (define_insn "vec_shr_"
   "TARGET_SIMD"
   {
 if (BYTES_BIG_ENDIAN)
-  return "shl %d0, %d1, %2";
+  return "shl\t%d0, %d1, %2";
 else
-  return "ushr %d0, %d1, %2";
+  return "ushr\t%d0, %d1, %2";
+  }
+  [(set_attr "type" "neon_shift_imm")]
+)
+(define_insn "vec_shl_"
+  [(set (match_operand:VD 0 "register_operand" "=w")
+(unspec:VD [(match_operand:VD 1 "register_operand" "w")
+   (match_operand:SI 2 "immediate_operand" "i")]
+  UNSPEC_VEC_SHL))]
+  "TARGET_SIMD"
+  {
+if (BYTES_BIG_ENDIAN)
+  return "ushr\t%d0, %d1, %2";
+else
+  return "shl\t%d0, %d1, %2";
   }
   [(set_attr "type" "neon_shift_imm")]
 )
diff --git a/gcc/config/aarch64/iterators.md b/gcc/config/aarch64/iterators.md
index 99cde46f1ba..3aebe9cf18a 100644
--- a/gcc/config/aarch64/iterators.md
+++ b/gcc/config/aarch64/iterators.md
@@ -758,6 +758,7 @@ (define_c_enum "unspec"
 UNSPEC_PMULL; Used in aarch64-simd.md.
 UNSPEC_PMULL2   ; Used in aarch64-simd.md.
 UNSPEC_REV_REGLIST  ; Used in aarch64-simd.md.
+UNSPEC_VEC_SHL  ; Used in aarch64-simd.md.
 UNSPEC_VEC_SHR  ; Used in aarch64-simd.md.
 UNSPEC_SQRDMLAH ; Used in aarch64-simd.md.
 UNSPEC_SQRDMLSH ; Used in aarch64-simd.md.
diff --git a/gcc/testsuite/gcc.target/aarch64/perm_zero-1.c 
b/gcc/testsuite/gcc.target/aarch64/perm_zero-1.c
new file mode 100644
index 000..3c8f0591a2f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/perm_zero-1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2"  } */
+/* PR target/113872 */
+/* For 64bit vectors, PERM with a constant 0 should produce a shift instead of 
the ext instruction. */
+
+#define vect64 __attribute__((vector_size(8)))
+
+void f(vect64  unsigned short *a)
+{
+  *a = __builtin_shufflevector((vect64 unsigned short){0},*a, 3,4,5,6);
+}
+
+/* { dg-final { scan-assembler-times "ushr\t" 1 { target aarch64_big_endian } 
} } */
+/* { dg-final { scan-assembler-times "shl\t" 1 { target aarch64_little_endian 
} } } */
+/* { dg-final { scan-assembler-not "ext\t"  } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/perm_zero-2.c 
b/gcc/testsuite/gcc.target/aarch64/perm_zero-2.c
new file mode 100644
index 000..970e428f832
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/perm_zero-2.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2"  } */
+/* PR target/113872 */
+/* For 64bit vectors, PERM with a constant 0 should produce a shift instead of 
the ext instruction. */
+
+#define vect64 __attribute__((vector_size(8)))
+
+void f(vect64  unsigned short *a)
+{
+  *a = __builtin_shufflevector(*a, (vect64 unsigned short){0},3,4,5,6);
+}
+
+/* { dg-final { scan-assembler-times "shl\t" 1 { target aarch64_big_endian } } 
} */
+/* { dg-final { scan-assembler-times "ushr\t" 1 { target aarch64_little_endian 
} } } */
+/* { dg-final { scan-assembler-not "ext\t"  } } */
-- 
2.43.0



[committed] Fix gcc.c-torture/execute/ieee/cdivchkf.c on hpux

2024-02-11 Thread John David Anglin
Tested on hppa64-hp-hpux11.11 and hppa-unknown-linux-gnu.
Committed to trunk.

Dave
---

Fix gcc.c-torture/execute/ieee/cdivchkf.c on hpux

2024-02-11  John David Anglin  

gcc/testsuite/ChangeLog:

* gcc.c-torture/execute/ieee/cdivchkf.c: Use ilogb and
__builtin_fmax instead of ilogbf and __builtin_fmaxf.

diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkf.c 
b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkf.c
index adf1ed91dc7..86ef69f8771 100644
--- a/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkf.c
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/cdivchkf.c
@@ -8,7 +8,7 @@
 extern void abort (void);
 extern void exit (int);
 
-extern int ilogbf (float);
+extern int ilogb (double);
 int match (float _Complex, float _Complex);
 
 #define SMALL FLT_MIN
@@ -22,7 +22,8 @@ int match (float _Complex, float _Complex);
 int match (float _Complex c, float _Complex z)
 {
   float rz, iz, rc, ic;
-  float rerr, ierr, rmax;
+  float rerr, ierr;
+  double rmax;
   int biterr;
   rz = __real__ z;
   iz = __imag__ z;
@@ -54,11 +55,11 @@ int match (float _Complex c, float _Complex z)
 {
   ierr = __builtin_fabsf (iz - ic) / SMALL;
 }
-  rmax = __builtin_fmaxf(rerr, ierr);
+  rmax = __builtin_fmax (rerr, ierr);
   biterr = 0;
   if ( rmax != 0.0)  
 {
-  biterr = ilogbf (rmax) + MAXBIT + 1;
+  biterr = ilogb (rmax) + MAXBIT + 1;
 }
 
   if (biterr >= ERRLIM)


signature.asc
Description: PGP signature


[committed] libgomp: Define config_path for hppa*-*-linux*

2024-02-11 Thread John David Anglin
Tested on hppa-unknown-linux-gnu.  Committed to trunk.

Dave
---

libgomp: Define config_path for hppa*-*-linux*

2024-02-11  John David Anglin  

libgomp/ChangeLog:

PR libgomp/113843
* configure.tgt (hppa*-*-linux*): Define config_path.

diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt
index 2cd7272fcd8..46af75f978f 100644
--- a/libgomp/configure.tgt
+++ b/libgomp/configure.tgt
@@ -52,6 +52,10 @@ if test x$enable_linux_futex = xyes; then
config_path="linux posix"
;;
 
+hppa*-*-linux*)
+   config_path="linux posix"
+   ;;
+
 ia64*-*-linux*)
config_path="linux/ia64 linux posix"
;;


signature.asc
Description: PGP signature


Re: [PATCH] Fortran - Error compiling PDT Type-bound Procedures [PR82943/86148/86268]

2024-02-11 Thread Harald Anlauf

Hi Alex,

I've been unable to apply your patch to my local trunk, likely due to
whitespace issues my newsreader handles differently from your site.
I see it inline instead of attached.

A few general remarks:

Please follow the general recommendation regarding style if possible,
see https://www.gnu.org/prep/standards/standards.html#Formatting
regarding formatting/whitespace use (5.1) and comments (5.2)

Also, when an error message text spans multiple lines, please place the
whitespace at the end of a line, not at the beginning of the new one:


+  if ( resolve_bindings_derived->attr.pdt_template &&
+   !gfc_pdt_is_instance_of(resolve_bindings_derived,
+   CLASS_DATA(me_arg)->ts.u.derived))
+{
+  gfc_error ("Argument %qs of %qs with PASS(%s) at %L must be of"
+" the parametric derived-type %qs", me_arg->name, proc->name,


  gfc_error ("Argument %qs of %qs with PASS(%s) at %L must be of "
 "the parametric derived-type %qs", me_arg->name,
proc->name,


+me_arg->name, , resolve_bindings_derived->name);
+  goto error;
+}


The following change is almost unreadable: the lnegthy comment is split
over three parts and almost hides the code.  Couldn't this be combined
into one comment before the function?


diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc
index fddf68f8398..11f4bac0415 100644
--- a/gcc/fortran/symbol.cc
+++ b/gcc/fortran/symbol.cc
@@ -5172,6 +5172,35 @@ gfc_type_is_extension_of (gfc_symbol *t1, gfc_symbol
*t2)
return gfc_compare_derived_types (t1, t2);
  }

+/* Check if a parameterized derived type t2 is an instance of a PDT
template t1 */
+
+bool
+gfc_pdt_is_instance_of(gfc_symbol *t1, gfc_symbol *t2)
+{
+  if ( !t1->attr.pdt_template || !t2->attr.pdt_type )
+return false;
+
+  /*
+in decl.cc, gfc_get_pdt_instance, a pdt instance is given a 3
character prefix "Pdt", followed
+by an underscore list of the kind parameters, up to a maximum of 8.
+
+So to check if a PDT Type corresponds to the template, extract the
core derive_type name,
+and then see if it is type compatible by name...
+
+For example:
+
+Pdtf_2_2 -> extract out the 'f' -> see if the derived type 'f' is
compatible with symbol t1
+  */
+
+  // Starting at index 3 of the string in order to skip past the 'Pdt'
prefix
+  // Also, here the length of the template name is used in order to avoid
the
+  // kind parameter suffixes that are placed at the end of PDT instance
names.
+  if ( !(strncmp(&(t2->name[3]), t1->name, strlen(t1->name)) == 0) )
+return false;
+
+  return true;
+}
+

  /* Check if two typespecs are type compatible (F03:5.1.1.2):
 If ts1 is nonpolymorphic, ts2 must be the same type.


The following testcase tests for errors.  I tried Intel and NAG on it
after commenting the 'contains' section of the type desclaration.
Both complained about subroutine deferred_len_param, e.g.

Intel:
A colon may only be used as a type parameter value in the declaration of
an object that has the POINTER or ALLOCATABLE attribute.   [THIS]
class(param_deriv_type(:)), intent(inout) :: this

NAG:
Entity THIS of type PARAM_DERIV_TYPE(A=:) has a deferred length type
parameter but is not a data pointer or allocatable

Do we detect this after your patch?  If the answer is yes,
can we add another subroutine where we check for this error?
(the dg-error suggests we only expect assumed len type parameters.)
If no, maybe add a comment in the testcase that this subroutine
may need updating later.


diff --git a/gcc/testsuite/gfortran.dg/pdt_37.f03
b/gcc/testsuite/gfortran.dg/pdt_37.f03
new file mode 100644
index 000..68d376fad25
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pdt_37.f03
@@ -0,0 +1,34 @@
+! { dg-do compile }
+!
+! Tests the fixes for PR82943.
+!
+! This test focuses on the errors produced by incorrect LEN parameters for
dummy
+! arguments of PDT Typebound Procedures.
+!
+! Contributed by Alexander Westbrooks  
+!
+module test_len_param
+
+   type :: param_deriv_type(a)
+   integer, len :: a
+   contains
+   procedure :: assumed_len_param   ! Good. No error expected.
+   procedure :: deferred_len_param  ! { dg-error "All LEN type
parameters of the passed dummy argument" }
+   procedure :: fixed_len_param ! { dg-error "All LEN type
parameters of the passed dummy argument" }
+   end type
+
+contains
+subroutine assumed_len_param(this)
+   class(param_deriv_type(*)), intent(inout) :: this
+end subroutine
+
+subroutine deferred_len_param(this)
+class(param_deriv_type(:)), intent(inout) :: this
+end subroutine
+
+subroutine fixed_len_param(this)
+class(param_deriv_type(10)), intent(inout) :: this
+end subroutine
+
+end module
+




Re: [PATCH] testsuite: Update test case to comply with GCC14 changes

2024-02-11 Thread Torbjorn SVENSSON




On 2024-02-11 20:01, Mike Stump wrote:

On Feb 10, 2024, at 7:21 AM, Torbjörn SVENSSON  
wrote:


I have confirmed that this updated pr97969.c file still hangs with
gcc-arm-none-eabi-9-2020-q2-update as mentioned in comment 2 of PR97969.

Ok for trunk?


Ok.


Pushed as f85450819414700a7883a7de128b03f655f43d44.


Re: [PATCH] i386, testsuite: adjust asm patterns

2024-02-11 Thread Mike Stump
On Feb 10, 2024, at 10:07 AM, FX Coudert  wrote:
> 
> The new testcase gcc.target/i386/asm-raw-symbol.c fails on darwin. This is 
> partly because symbols are prefixed with underscore, and also because the 
> order of operands in the addition is reversed (but I think it’s valid still). 
> The code generated is this:
> 
> _func:
> LFB0:
>pushq   %rbp
> LCFI0:
>movq%rsp, %rbp
> LCFI1:
> # 8 "/Users/fx/gcc-upstream/gcc/testsuite/gcc.target/i386/asm-raw-symbol.c" 1
>@ _func
> # 0 "" 2
> # 9 "/Users/fx/gcc-upstream/gcc/testsuite/gcc.target/i386/asm-raw-symbol.c" 1
>@ 4+_var
> # 0 "" 2
>nop
>popq%rbp
> LCFI2:
>ret
> 
> 
> 
> I’m adjusting the pattern accordingly.
> OK to push?

Ok.

Re: [PATCH] testsuite: Update test case to comply with GCC14 changes

2024-02-11 Thread Mike Stump
On Feb 10, 2024, at 7:21 AM, Torbjörn SVENSSON  
wrote:
> 
> I have confirmed that this updated pr97969.c file still hangs with
> gcc-arm-none-eabi-9-2020-q2-update as mentioned in comment 2 of PR97969.
> 
> Ok for trunk?

Ok.

[PATCH] c++/modules: Finalise non-local imported vars [PR113708]

2024-02-11 Thread Nathaniel Shead
Bootstrapped and regtested (just modules.exp so far) on
x86_64-pc-linux-gnu, OK for trunk if full regtest succeeds?

-- >8 --

Currently inline vars imported from modules aren't correctly finalised,
which means that import_export_decl gets called at the end of TU
processing despite not being meant to for these kinds of declarations.

This patch takes the logic from 'make_rtl_for_nonlocal_decl' to
determine when to perform rest of decl compilation on these decls.
However other parts of this function (asmspec handling) are not yet
covered.

PR c++/113708

gcc/cp/ChangeLog:

* module.cc (trees_in::read_var_def): Perform rest of decl
compilation on non-local statics.

gcc/testsuite/ChangeLog:

* g++.dg/modules/init-7_a.H: New test.
* g++.dg/modules/init-7_b.C: New test.

Signed-off-by: Nathaniel Shead 
---
 gcc/cp/module.cc| 12 +++-
 gcc/testsuite/g++.dg/modules/init-7_a.H |  6 ++
 gcc/testsuite/g++.dg/modules/init-7_b.C |  6 ++
 3 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/g++.dg/modules/init-7_a.H
 create mode 100644 gcc/testsuite/g++.dg/modules/init-7_b.C

diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 560d8f3b614..49a3421e6cc 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -11809,6 +11809,7 @@ trees_in::read_var_def (tree decl, tree maybe_template)
 {
   if (DECL_EXTERNAL (decl))
DECL_NOT_REALLY_EXTERN (decl) = true;
+  DECL_INITIAL (decl) = init;
   if (VAR_P (decl))
{
  DECL_INITIALIZED_P (decl) = true;
@@ -11819,8 +11820,17 @@ trees_in::read_var_def (tree decl, tree maybe_template)
  && !DECL_VTABLE_OR_VTT_P (decl)
  && !DECL_TEMPLATE_INFO (decl)))
note_vague_linkage_variable (decl);
+
+ /* Emit RTL as needed, as with make_rtl_for_nonlocal_decl.  */
+ // FIXME: Handle asmspec?
+ if ((!DECL_FUNCTION_SCOPE_P (decl)
+  || (TREE_STATIC (decl) && var_in_maybe_constexpr_fn (decl)))
+ && !DECL_VIRTUAL_P (decl)
+ && (!DECL_TEMPLATE_INFO (decl)
+ || DECL_EXPLICIT_INSTANTIATION (decl)))
+   rest_of_decl_compilation (decl, !DECL_FUNCTION_SCOPE_P (decl),
+ /*at_end=*/0);
}
-  DECL_INITIAL (decl) = init;
   if (!dyn_init)
;
   else if (CP_DECL_THREAD_LOCAL_P (decl))
diff --git a/gcc/testsuite/g++.dg/modules/init-7_a.H 
b/gcc/testsuite/g++.dg/modules/init-7_a.H
new file mode 100644
index 000..7a0bb721c30
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/init-7_a.H
@@ -0,0 +1,6 @@
+// PR c++/113708
+// { dg-additional-options "-fmodule-header" }
+// { dg-module-cmi {} }
+
+inline int f() { return 42; }
+inline int a = f();
diff --git a/gcc/testsuite/g++.dg/modules/init-7_b.C 
b/gcc/testsuite/g++.dg/modules/init-7_b.C
new file mode 100644
index 000..58bb0620ca5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/init-7_b.C
@@ -0,0 +1,6 @@
+// PR c++/113708
+// { dg-module-do link }
+// { dg-additional-options "-fmodules-ts" }
+
+import "init-7_a.H";
+int main() { a; }
-- 
2.43.0