diff -Nrcpad gcc-13-20260708/LAST_UPDATED gcc-13-20260715/LAST_UPDATED
*** gcc-13-20260708/LAST_UPDATED	Wed Jul  8 22:32:21 2026
--- gcc-13-20260715/LAST_UPDATED	Wed Jul 15 22:32:21 2026
***************
*** 1 ****
! Obtained from git: releases/gcc-13 revision 7a4c816ebf3f61b62b816f80c692ae6242843ace
--- 1 ----
! Obtained from git: releases/gcc-13 revision b8f6cf42cf8972e9ee7adf4150f06703a35b2eb6
diff -Nrcpad gcc-13-20260708/MD5SUMS gcc-13-20260715/MD5SUMS
*** gcc-13-20260708/MD5SUMS	Wed Jul  8 22:32:25 2026
--- gcc-13-20260715/MD5SUMS	Wed Jul 15 22:32:25 2026
***************
*** 1,5 ****
  # This file contains the MD5 checksums of the files in the
! # gcc-13-20260708.tar.xz tarball.
  #
  # Besides verifying that all files in the tarball were correctly expanded,
  # it also can be used to determine if any files have changed since the
--- 1,5 ----
  # This file contains the MD5 checksums of the files in the
! # gcc-13-20260715.tar.xz tarball.
  #
  # Besides verifying that all files in the tarball were correctly expanded,
  # it also can be used to determine if any files have changed since the
*************** d32239bcb673463ab874e80d47fae504  COPYIN
*** 21,27 ****
  fd4ecdf5d672efe2b0e409aca9cf9446  ChangeLog.jit
  09538b708302f1735f6fa05b622ecf5e  ChangeLog.tree-ssa
  24ab760126489e69436a43185dc3d202  INSTALL/README
! 67c1ce6c3930bb01fced10c4b8ff2176  LAST_UPDATED
  81b3330d422f3ce1ef8b720dfae35068  MAINTAINERS
  2b61ddbd876fa839639a7ca551773426  Makefile.def
  5d2d6a74f897f8158d37f5f2ec6877ce  Makefile.in
--- 21,27 ----
  fd4ecdf5d672efe2b0e409aca9cf9446  ChangeLog.jit
  09538b708302f1735f6fa05b622ecf5e  ChangeLog.tree-ssa
  24ab760126489e69436a43185dc3d202  INSTALL/README
! 1fe760a5ea121a550af1fb955333b912  LAST_UPDATED
  81b3330d422f3ce1ef8b720dfae35068  MAINTAINERS
  2b61ddbd876fa839639a7ca551773426  Makefile.def
  5d2d6a74f897f8158d37f5f2ec6877ce  Makefile.in
*************** a22e70b3f29292d0e628450f4bb11e62  fixinc
*** 475,481 ****
  a916467b91076e631dd8edb7424769c7  gcc/COPYING.LIB
  d32239bcb673463ab874e80d47fae504  gcc/COPYING3
  6a6a8e020838b23406c81b19c1d46df6  gcc/COPYING3.LIB
! 0dd8667cfa24f2e2db761f3633e52950  gcc/ChangeLog
  a3b63c675afa7a655cc2bfa8a907af79  gcc/ChangeLog-1997
  d9a88529352a010253c2e8fb1ed6023b  gcc/ChangeLog-1998
  240f08f81cb4699e8b49347db38233db  gcc/ChangeLog-1999
--- 475,481 ----
  a916467b91076e631dd8edb7424769c7  gcc/COPYING.LIB
  d32239bcb673463ab874e80d47fae504  gcc/COPYING3
  6a6a8e020838b23406c81b19c1d46df6  gcc/COPYING3.LIB
! c7c1e80a1d7ca2d71fcc2c19ebc04e1e  gcc/ChangeLog
  a3b63c675afa7a655cc2bfa8a907af79  gcc/ChangeLog-1997
  d9a88529352a010253c2e8fb1ed6023b  gcc/ChangeLog-1998
  240f08f81cb4699e8b49347db38233db  gcc/ChangeLog-1999
*************** fb3fadb88e1d2b3b640cfaaa5ff11780  gcc/Ch
*** 510,516 ****
  3eb07e0b2e542409bf73d359f7f65609  gcc/ChangeLog.ptr
  e13638e26743ba41e6011b76cc00d9a9  gcc/ChangeLog.tree-ssa
  739ab47f6425bcea1d05e4fc0542de54  gcc/ChangeLog.tuples
! 16e284e1706bb32e78adddac82509b0f  gcc/DATESTAMP
  d41d8cd98f00b204e9800998ecf8427e  gcc/DEV-PHASE
  eb92e1ff5e982ca07e173e0eb286d243  gcc/FSFChangeLog
  30e1e33411566388b3164558482dc5e6  gcc/FSFChangeLog.10
--- 510,516 ----
  3eb07e0b2e542409bf73d359f7f65609  gcc/ChangeLog.ptr
  e13638e26743ba41e6011b76cc00d9a9  gcc/ChangeLog.tree-ssa
  739ab47f6425bcea1d05e4fc0542de54  gcc/ChangeLog.tuples
! b2fe402e4e134d0851eb02507afe88ac  gcc/DATESTAMP
  d41d8cd98f00b204e9800998ecf8427e  gcc/DEV-PHASE
  eb92e1ff5e982ca07e173e0eb286d243  gcc/FSFChangeLog
  30e1e33411566388b3164558482dc5e6  gcc/FSFChangeLog.10
*************** c2dbf831f4bbc53553765214d1b2d674  gcc/fl
*** 5576,5582 ****
  46538296abcbd26df93f276f5974ec0f  gcc/fold-const-call.h
  e091b0ed4e31525d6d685d5e6f7a7fa0  gcc/fold-const.cc
  9dd2c87502c864095a8b942bea07b5f3  gcc/fold-const.h
! fca0a2926591d6a12937d1d9d28f35ac  gcc/fortran/ChangeLog
  3330102ad3a0217cba963be6b5eefd58  gcc/fortran/ChangeLog-2002
  d000ab985b1eeb1ad5749f98b8fef99f  gcc/fortran/ChangeLog-2003
  bf42f94f0c51dcc7d8051cc7fda1efdc  gcc/fortran/ChangeLog-2004
--- 5576,5582 ----
  46538296abcbd26df93f276f5974ec0f  gcc/fold-const-call.h
  e091b0ed4e31525d6d685d5e6f7a7fa0  gcc/fold-const.cc
  9dd2c87502c864095a8b942bea07b5f3  gcc/fold-const.h
! 34004fd4f6415f13606a50146900d942  gcc/fortran/ChangeLog
  3330102ad3a0217cba963be6b5eefd58  gcc/fortran/ChangeLog-2002
  d000ab985b1eeb1ad5749f98b8fef99f  gcc/fortran/ChangeLog-2003
  bf42f94f0c51dcc7d8051cc7fda1efdc  gcc/fortran/ChangeLog-2004
*************** e626fc9f74be348b19ed678ca99adfee  gcc/fo
*** 5619,5625 ****
  528121f9fe625a6b314dd0e4e9601e70  gcc/fortran/dependency.h
  638a4c6c1f147853ccf44c5442c876f9  gcc/fortran/dump-parse-tree.cc
  75860b58e8a01aadbfb046789efa8a88  gcc/fortran/error.cc
! 0af32ed33f5748db7e33876cb180cbb3  gcc/fortran/expr.cc
  012392c6483a51939022df7c6de22fbc  gcc/fortran/f95-lang.cc
  9ba3df765f32f1f6aab588f53218058a  gcc/fortran/frontend-passes.cc
  5d21a6b2bc38e36e9ce485f9b899cf5d  gcc/fortran/gfc-diagnostic.def
--- 5619,5625 ----
  528121f9fe625a6b314dd0e4e9601e70  gcc/fortran/dependency.h
  638a4c6c1f147853ccf44c5442c876f9  gcc/fortran/dump-parse-tree.cc
  75860b58e8a01aadbfb046789efa8a88  gcc/fortran/error.cc
! 3725916ccfbe7e562baf467809385bea  gcc/fortran/expr.cc
  012392c6483a51939022df7c6de22fbc  gcc/fortran/f95-lang.cc
  9ba3df765f32f1f6aab588f53218058a  gcc/fortran/frontend-passes.cc
  5d21a6b2bc38e36e9ce485f9b899cf5d  gcc/fortran/gfc-diagnostic.def
*************** c310fb2cf5f2bb20fbf7f911e7a5b2cc  gcc/fo
*** 5650,5656 ****
  47d8fa5113c1f84c750b8fa73bbc5cfa  gcc/fortran/options.cc
  c0c3bcf7a95794a179458f5f74c2d450  gcc/fortran/parse.cc
  b07d21325e9bf64201a6131a3dacb9e2  gcc/fortran/parse.h
! 0b0dcac362edd98a98305776d6738ab4  gcc/fortran/primary.cc
  2fbe151fd04a3c2bb12a256141ae86ba  gcc/fortran/resolve.cc
  f1620f6af6f4d226dd7e0ee858f8bd10  gcc/fortran/scanner.cc
  0ea05c5f1f9c27f26a76525f5eed9380  gcc/fortran/scanner.h
--- 5650,5656 ----
  47d8fa5113c1f84c750b8fa73bbc5cfa  gcc/fortran/options.cc
  c0c3bcf7a95794a179458f5f74c2d450  gcc/fortran/parse.cc
  b07d21325e9bf64201a6131a3dacb9e2  gcc/fortran/parse.h
! 5f0c0fe49a7aa8f038cc4438385e178e  gcc/fortran/primary.cc
  2fbe151fd04a3c2bb12a256141ae86ba  gcc/fortran/resolve.cc
  f1620f6af6f4d226dd7e0ee858f8bd10  gcc/fortran/scanner.cc
  0ea05c5f1f9c27f26a76525f5eed9380  gcc/fortran/scanner.h
*************** d7be9766180ba9d84c17fe538c02907f  gcc/fo
*** 5659,5665 ****
  f517590a45dbb7448f8bdabbb424c775  gcc/fortran/symbol.cc
  e99e43daa5fef5f3d2c6dce6be81a683  gcc/fortran/target-memory.cc
  70445c82cc8c84eb76adf2a52acad00d  gcc/fortran/target-memory.h
! b16988fb11ef93959450cfdd9eaa8825  gcc/fortran/trans-array.cc
  23946ddd5d17c204402c44a0b9a00d75  gcc/fortran/trans-array.h
  4c2eb969dbee5d6b83074ed09773b70b  gcc/fortran/trans-common.cc
  45ab297b0b34853431ed0f3c09a63db3  gcc/fortran/trans-const.cc
--- 5659,5665 ----
  f517590a45dbb7448f8bdabbb424c775  gcc/fortran/symbol.cc
  e99e43daa5fef5f3d2c6dce6be81a683  gcc/fortran/target-memory.cc
  70445c82cc8c84eb76adf2a52acad00d  gcc/fortran/target-memory.h
! 58e546cf9b9d8cae6a139cd3aa0f2049  gcc/fortran/trans-array.cc
  23946ddd5d17c204402c44a0b9a00d75  gcc/fortran/trans-array.h
  4c2eb969dbee5d6b83074ed09773b70b  gcc/fortran/trans-common.cc
  45ab297b0b34853431ed0f3c09a63db3  gcc/fortran/trans-const.cc
*************** b829ed0032c899e107be2db349c913f3  gcc/ta
*** 7637,7643 ****
  811da275a2b9d3186a6decf96c01b0ed  gcc/targhooks.cc
  edb193a32070c4a7626fb75382def9b9  gcc/targhooks.h
  f39fcaa8197187283ccfed40107b426d  gcc/testsuite/.gitattributes
! f24a1c7400b6b3771cb95a37fa064879  gcc/testsuite/ChangeLog
  862f04afbd87da2cc6bc432c3f28430f  gcc/testsuite/ChangeLog-1993-2007
  029a5d8dacd25eb5d4711452ac448e5b  gcc/testsuite/ChangeLog-2008
  13ac28c41d51b66b4ec40dba6bd50f39  gcc/testsuite/ChangeLog-2009
--- 7637,7643 ----
  811da275a2b9d3186a6decf96c01b0ed  gcc/targhooks.cc
  edb193a32070c4a7626fb75382def9b9  gcc/targhooks.h
  f39fcaa8197187283ccfed40107b426d  gcc/testsuite/.gitattributes
! f81542cf32b15b8f793761620fd0563b  gcc/testsuite/ChangeLog
  862f04afbd87da2cc6bc432c3f28430f  gcc/testsuite/ChangeLog-1993-2007
  029a5d8dacd25eb5d4711452ac448e5b  gcc/testsuite/ChangeLog-2008
  13ac28c41d51b66b4ec40dba6bd50f39  gcc/testsuite/ChangeLog-2009
*************** c6848ef9d4a9873e77016b18db0eef64  gcc/te
*** 49983,49988 ****
--- 49983,49989 ----
  5f36d3d6eda4211f506ed2e65fc779c4  gcc/testsuite/gcc.dg/tree-ssa/pr117423.c
  b0891b1dddf226da47f4f976abdd7cb0  gcc/testsuite/gcc.dg/tree-ssa/pr119085.c
  71eb14b3ae5faf81c5226dc766d48edd  gcc/testsuite/gcc.dg/tree-ssa/pr122976.c
+ d87a1ad6187c06f07e6ee3b7c6352e9e  gcc/testsuite/gcc.dg/tree-ssa/pr124151.c
  78e6c5fe63f7305009c8a79840fe20dc  gcc/testsuite/gcc.dg/tree-ssa/pr13146.c
  eab19e0c04884cd782c9879cbe292109  gcc/testsuite/gcc.dg/tree-ssa/pr14341.c
  9945ed7002a5f7d4918e8ff5eb4cb647  gcc/testsuite/gcc.dg/tree-ssa/pr14490-1.c
*************** c35066e873add73fe333d803e2854739  gcc/te
*** 89523,89528 ****
--- 89524,89533 ----
  48782be659f3ec5c8d9cba03ca6cc43d  gcc/testsuite/gfortran.dg/pr103286.f90
  ce86820082e25f5aad2607f9163c3cf4  gcc/testsuite/gfortran.dg/pr103312.f90
  ab2e9f64b18aaf6df9600288ded6ce51  gcc/testsuite/gfortran.dg/pr103366.f90
+ f5b2d7909d22359486a362b6e2b6e6d2  gcc/testsuite/gfortran.dg/pr103367.f90
+ c35efc88e117f86638938a16d6b88054  gcc/testsuite/gfortran.dg/pr103367_2.f90
+ 8a27376a5ce044b06ca3b47f787353d7  gcc/testsuite/gfortran.dg/pr103367_3.f90
+ 066ab4b80e43f24da3f7fe87a2cf8014  gcc/testsuite/gfortran.dg/pr103367_4.f90
  9e00f34ad9d6d78b98007d4ad68251f5  gcc/testsuite/gfortran.dg/pr103389.f90
  5403c8d36e959e2211ecc4f2a1db6e1c  gcc/testsuite/gfortran.dg/pr103475.f90
  b624133cafd19857eb2915c507731455  gcc/testsuite/gfortran.dg/pr103504.f90
*************** feca017a2b8993f6879429c3b7fa9740  gcc/tr
*** 100653,100659 ****
  13e933e748d0799695ef67be87740769  gcc/tree-profile.cc
  c48cd3335056d0f516107ea6b728d398  gcc/tree-scalar-evolution.cc
  b8223329488a4001552728350c5dbbef  gcc/tree-scalar-evolution.h
! 6fd6cf5046eb913b128365fa0b3c50d6  gcc/tree-sra.cc
  1f7981f8ac0c98c7d1acb674035e2c16  gcc/tree-sra.h
  931fca6fc15298fa1f2021f8e4f2ed8d  gcc/tree-ssa-address.cc
  c37e139873f3e8da2fffefa09903ee42  gcc/tree-ssa-address.h
--- 100658,100664 ----
  13e933e748d0799695ef67be87740769  gcc/tree-profile.cc
  c48cd3335056d0f516107ea6b728d398  gcc/tree-scalar-evolution.cc
  b8223329488a4001552728350c5dbbef  gcc/tree-scalar-evolution.h
! 7911dc1647f159903a7b02949f0ae9ef  gcc/tree-sra.cc
  1f7981f8ac0c98c7d1acb674035e2c16  gcc/tree-sra.h
  931fca6fc15298fa1f2021f8e4f2ed8d  gcc/tree-ssa-address.cc
  c37e139873f3e8da2fffefa09903ee42  gcc/tree-ssa-address.h
diff -Nrcpad gcc-13-20260708/gcc/ChangeLog gcc-13-20260715/gcc/ChangeLog
*** gcc-13-20260708/gcc/ChangeLog	Wed Jul  8 22:32:05 2026
--- gcc-13-20260715/gcc/ChangeLog	Wed Jul 15 22:32:05 2026
***************
*** 1,3 ****
--- 1,20 ----
+ 2026-07-09  Martin Jambor  <mjambor@suse.cz>
+ 
+ 	Backported from master:
+ 	2026-05-12  Martin Jambor  <mjambor@suse.cz>
+ 
+ 	PR tree-optimization/124151
+ 	* tree-sra.cc (build_user_friendly_ref_for_offset): Added parameters
+ 	CUR_SIZE and EXP_SIZE.  Added code passing the correct CUR_SIZE and
+ 	checking it against EXP_SIZE.  Removed unused code for the case when
+ 	EXP_TYPE was NULL_TREE.
+ 	(create_artificial_child_access): Adjusted the call to
+ 	build_user_friendly_ref_for_offset.
+ 	(propagate_subaccesses_from_rhs): Likewise.
+ 	(propagate_subaccesses_from_rhs): Removed a check that the size of
+ 	lchild is a multiple of BITS_PER_UNIT.
+ 	(propagate_subaccesses_from_lhs): Likewise.
+ 
  2026-07-05  Oleg Endo  <olegendo@gcc.gnu.org>
  
  	PR target/67459
diff -Nrcpad gcc-13-20260708/gcc/DATESTAMP gcc-13-20260715/gcc/DATESTAMP
*** gcc-13-20260708/gcc/DATESTAMP	Wed Jul  8 22:32:06 2026
--- gcc-13-20260715/gcc/DATESTAMP	Wed Jul 15 22:32:06 2026
***************
*** 1 ****
! 20260708
--- 1 ----
! 20260715
diff -Nrcpad gcc-13-20260708/gcc/fortran/ChangeLog gcc-13-20260715/gcc/fortran/ChangeLog
*** gcc-13-20260708/gcc/fortran/ChangeLog	Wed Jul  8 22:32:08 2026
--- gcc-13-20260715/gcc/fortran/ChangeLog	Wed Jul 15 22:32:08 2026
***************
*** 1,3 ****
--- 1,36 ----
+ 2026-07-09  Christopher Albert  <albert@tugraz.at>
+ 
+ 	Backported from master:
+ 	2026-04-09  Christopher Albert  <albert@tugraz.at>
+ 
+ 	PR fortran/103367
+ 	* trans-array.cc (gfc_conv_array_initializer): Emit an error for
+ 	invalid residual initializer expressions before returning a safe
+ 	empty constructor.
+ 
+ 2026-07-09  Christopher Albert  <albert@tugraz.at>
+ 
+ 	Backported from master:
+ 	2026-04-07  Christopher Albert  <albert@tugraz.at>
+ 
+ 	PR fortran/103367
+ 	* trans-array.cc (gfc_conv_array_initializer): Return empty
+ 	constructor for unexpected expression types after parameter
+ 	substitution.
+ 
+ 2026-07-09  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+ 
+ 	Backported from master:
+ 	2026-07-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+ 
+ 	PR fortran/103367
+ 	* expr.cc (simplify_const_ref): Hoist the call to
+ 	remove_subobject_ref up a level.
+ 	* primary.cc (gfc_match_rvalue): Don't copy the value expr
+ 	if the type is an EXPR_VARIABLE.
+ 	* trans-array.cc (gfc_conv_array_initializer): Only copy the expr
+ 	value if it does not have a ref.
+ 
  2026-05-21  Thomas Koenig  <tkoenig@gcc.gnu.org>
  
  	Backported from master:
diff -Nrcpad gcc-13-20260708/gcc/fortran/expr.cc gcc-13-20260715/gcc/fortran/expr.cc
*** gcc-13-20260708/gcc/fortran/expr.cc	Wed Jul  8 22:32:08 2026
--- gcc-13-20260715/gcc/fortran/expr.cc	Wed Jul 15 22:32:08 2026
*************** simplify_const_ref (gfc_expr *p)
*** 1939,1954 ****
        switch (p->ref->type)
  	{
  	case REF_ARRAY:
! 	  switch (p->ref->u.ar.type)
  	    {
! 	    case AR_ELEMENT:
! 	      /* <type/kind spec>, parameter :: x(<int>) = scalar_expr
! 		 will generate this.  */
! 	      if (p->expr_type != EXPR_ARRAY)
  		{
! 		  remove_subobject_ref (p, NULL);
! 		  break;
  		}
  	      if (!find_array_element (p->value.constructor, &p->ref->u.ar, &cons))
  		return false;
  
--- 1939,1964 ----
        switch (p->ref->type)
  	{
  	case REF_ARRAY:
! 	  /* <type/kind spec>, parameter :: x(<int>) = scalar_expr
! 	     will generate this.  */
! 	  if (p->expr_type != EXPR_ARRAY)
  	    {
! 	      if (p->ref->u.ar.type == AR_ELEMENT)
  		{
! 		  int dim;
! 		  for (dim = 0; dim < p->ref->u.ar.dimen; dim++)
! 		    if (!p->ref->u.ar.start[dim]
! 			|| p->ref->u.ar.start[dim]->expr_type != EXPR_CONSTANT)
! 		      return true;
  		}
+ 
+ 	      remove_subobject_ref (p, NULL);
+ 	      break;
+ 	    }
+ 
+ 	  switch (p->ref->u.ar.type)
+ 	    {
+ 	    case AR_ELEMENT:
  	      if (!find_array_element (p->value.constructor, &p->ref->u.ar, &cons))
  		return false;
  
diff -Nrcpad gcc-13-20260708/gcc/fortran/primary.cc gcc-13-20260715/gcc/fortran/primary.cc
*** gcc-13-20260708/gcc/fortran/primary.cc	Wed Jul  8 22:32:08 2026
--- gcc-13-20260715/gcc/fortran/primary.cc	Wed Jul 15 22:32:08 2026
*************** gfc_match_rvalue (gfc_expr **result)
*** 3627,3633 ****
  	 end up here.  Unfortunately, sym->value->expr_type is set to
  	 EXPR_CONSTANT, and so the if () branch would be followed without
  	 the !sym->as check.  */
!       if (sym->value && sym->value->expr_type != EXPR_ARRAY && !sym->as)
  	e = gfc_copy_expr (sym->value);
        else
  	{
--- 3627,3634 ----
  	 end up here.  Unfortunately, sym->value->expr_type is set to
  	 EXPR_CONSTANT, and so the if () branch would be followed without
  	 the !sym->as check.  */
!       if (sym->value && sym->value->expr_type != EXPR_ARRAY
! 	  && sym->value->expr_type != EXPR_VARIABLE && !sym->as)
  	e = gfc_copy_expr (sym->value);
        else
  	{
diff -Nrcpad gcc-13-20260708/gcc/fortran/trans-array.cc gcc-13-20260715/gcc/fortran/trans-array.cc
*** gcc-13-20260708/gcc/fortran/trans-array.cc	Wed Jul  8 22:32:08 2026
--- gcc-13-20260715/gcc/fortran/trans-array.cc	Wed Jul 15 22:32:08 2026
*************** gfc_conv_array_initializer (tree type, g
*** 6378,6386 ****
  
    if (expr->expr_type == EXPR_VARIABLE
        && expr->symtree->n.sym->attr.flavor == FL_PARAMETER
!       && expr->symtree->n.sym->value)
      expr = expr->symtree->n.sym->value;
  
    switch (expr->expr_type)
      {
      case EXPR_CONSTANT:
--- 6378,6400 ----
  
    if (expr->expr_type == EXPR_VARIABLE
        && expr->symtree->n.sym->attr.flavor == FL_PARAMETER
!       && expr->symtree->n.sym->value
!       && !expr->ref)
      expr = expr->symtree->n.sym->value;
  
+   /* After parameter substitution the expression should be a constant, array
+      constructor, structure constructor, or NULL.  Anything else is invalid
+      and must not ICE later in lowering.  */
+   if (expr->expr_type != EXPR_CONSTANT
+       && expr->expr_type != EXPR_STRUCTURE
+       && expr->expr_type != EXPR_ARRAY
+       && expr->expr_type != EXPR_NULL)
+     {
+       gfc_error ("Array initializer at %L does not reduce to a constant "
+ 		 "expression", &expr->where);
+       return build_constructor (type, NULL);
+     }
+ 
    switch (expr->expr_type)
      {
      case EXPR_CONSTANT:
diff -Nrcpad gcc-13-20260708/gcc/testsuite/ChangeLog gcc-13-20260715/gcc/testsuite/ChangeLog
*** gcc-13-20260708/gcc/testsuite/ChangeLog	Wed Jul  8 22:32:10 2026
--- gcc-13-20260715/gcc/testsuite/ChangeLog	Wed Jul 15 22:32:10 2026
***************
*** 1,3 ****
--- 1,38 ----
+ 2026-07-09  Christopher Albert  <albert@tugraz.at>
+ 
+ 	Backported from master:
+ 	2026-04-09  Christopher Albert  <albert@tugraz.at>
+ 
+ 	PR fortran/103367
+ 	* gfortran.dg/pr103367.f90: Expect a constant-expression error and
+ 	prune the legacy-extension warning.
+ 
+ 2026-07-09  Christopher Albert  <albert@tugraz.at>
+ 
+ 	Backported from master:
+ 	2026-04-07  Christopher Albert  <albert@tugraz.at>
+ 
+ 	PR fortran/103367
+ 	* gfortran.dg/pr103367.f90: New test.
+ 
+ 2026-07-09  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+ 
+ 	Backported from master:
+ 	2026-07-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+ 
+ 	PR fortran/103367
+ 	* gfortran.dg/pr103367_2.f90: New test.
+ 	* gfortran.dg/pr103367_3.f90: New test.
+ 	* gfortran.dg/pr103367_4.f90: New test.
+ 
+ 2026-07-09  Martin Jambor  <mjambor@suse.cz>
+ 
+ 	Backported from master:
+ 	2026-05-12  Martin Jambor  <mjambor@suse.cz>
+ 
+ 	PR tree-optimization/124151
+ 	* gcc.dg/tree-ssa/pr124151.c: New test.
+ 
  2026-07-05  Oleg Endo  <olegendo@gcc.gnu.org>
  
  	PR target/67459
diff -Nrcpad gcc-13-20260708/gcc/testsuite/gcc.dg/tree-ssa/pr124151.c gcc-13-20260715/gcc/testsuite/gcc.dg/tree-ssa/pr124151.c
*** gcc-13-20260708/gcc/testsuite/gcc.dg/tree-ssa/pr124151.c	Thu Jan  1 00:00:00 1970
--- gcc-13-20260715/gcc/testsuite/gcc.dg/tree-ssa/pr124151.c	Wed Jul 15 22:32:12 2026
***************
*** 0 ****
--- 1,31 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O1" } */
+ 
+ typedef struct {
+   _Bool : 1;
+ } Http2Identifier;
+ typedef struct {
+   _Bool is_end;
+   Http2Identifier identifier;
+ } Http2DataFrame;
+ typedef struct {
+   Http2Identifier identifier;
+   _Bool end_headers;
+ } Http2ContinuationFrame;
+ typedef struct {
+   union {
+     Http2DataFrame data;
+     Http2ContinuationFrame continuation;
+   };
+ } Http2Frame;
+ typedef struct {
+   Http2Identifier stream_identifier;
+ } Http2RawHeader;
+ Http2RawHeader parse_http2_continuation_frame_http2_raw_header;
+ Http2Frame gh2f;
+ void http2_send_and_receive_preface() {
+   Http2ContinuationFrame continuation_frame = {
+       parse_http2_continuation_frame_http2_raw_header.stream_identifier, 0};
+   Http2Frame frame = {.continuation = continuation_frame};
+   gh2f = frame;
+ }
diff -Nrcpad gcc-13-20260708/gcc/testsuite/gfortran.dg/pr103367.f90 gcc-13-20260715/gcc/testsuite/gfortran.dg/pr103367.f90
*** gcc-13-20260708/gcc/testsuite/gfortran.dg/pr103367.f90	Thu Jan  1 00:00:00 1970
--- gcc-13-20260715/gcc/testsuite/gfortran.dg/pr103367.f90	Wed Jul 15 22:32:14 2026
***************
*** 0 ****
--- 1,15 ----
+ ! { dg-do compile }
+ !
+ ! PR fortran/103367
+ ! Invalid initialization expressions must not ICE if they survive
+ ! semantic checking and reach array initializer lowering.
+ 
+ program p
+   type t
+     integer :: a(1,2) = 3
+   end type
+   type(t), parameter :: x(1) = t(4)
+   integer :: y(1,2) = (x(b)%a) ! { dg-error "does not reduce to a constant expression" }
+   print *, y
+ end
+ ! { dg-prune-output "Legacy Extension: REAL array index" }
diff -Nrcpad gcc-13-20260708/gcc/testsuite/gfortran.dg/pr103367_2.f90 gcc-13-20260715/gcc/testsuite/gfortran.dg/pr103367_2.f90
*** gcc-13-20260708/gcc/testsuite/gfortran.dg/pr103367_2.f90	Thu Jan  1 00:00:00 1970
--- gcc-13-20260715/gcc/testsuite/gfortran.dg/pr103367_2.f90	Wed Jul 15 22:32:14 2026
***************
*** 0 ****
--- 1,37 ----
+ ! { dg-do compile }
+ subroutine s1
+   type t
+     integer :: a(1,2) = 3
+   end type
+   type(t), parameter :: x(1) = t(4)
+   integer, parameter :: y(1,2) = (x(1)%a(m,1)) ! { dg-error "does not reduce to a constant expression" }
+   print *, y
+ end
+ 
+ subroutine s2
+   type t
+     integer :: a(2) = 3!
+   end type
+   type(t), parameter :: x(1) = t(4)
+   integer, parameter :: y = x(1)%a(m) ! { dg-error "non-constant initialization expression" }
+   print *, y
+ end
+ 
+ subroutine s3
+   type t
+     integer :: a(1,2) = 3
+   end type
+   type(t), parameter :: x(1) = t(4)
+   integer, parameter :: y(1,2) = (x(b)%a) ! { dg-error "does not reduce to a constant expression" }
+   print *, y
+ end
+ 
+ subroutine s4
+   type t
+     integer :: a(1,2) = 3
+   end type
+   type(t), parameter :: x(1) = t(4)
+   integer :: y(1,2) = x(b)%a ! { dg-error "does not reduce to a constant expression" }
+   print *, y
+ end
+ ! { dg-prune-output "Legacy Extension: REAL array index" }
diff -Nrcpad gcc-13-20260708/gcc/testsuite/gfortran.dg/pr103367_3.f90 gcc-13-20260715/gcc/testsuite/gfortran.dg/pr103367_3.f90
*** gcc-13-20260708/gcc/testsuite/gfortran.dg/pr103367_3.f90	Thu Jan  1 00:00:00 1970
--- gcc-13-20260715/gcc/testsuite/gfortran.dg/pr103367_3.f90	Wed Jul 15 22:32:14 2026
***************
*** 0 ****
--- 1,11 ----
+ ! { dg-do run }
+ ! PR103367 Test case from the PR, previously segfaulted.
+ program p
+   type t
+      integer :: a(1,2) = 3
+   end type
+   type(t), parameter :: x(1) = t(4)
+   integer, parameter :: y(2) = x(1)%a(1,:)
+   if (any (y /= [4, 4])) stop 1
+ end
+ 
diff -Nrcpad gcc-13-20260708/gcc/testsuite/gfortran.dg/pr103367_4.f90 gcc-13-20260715/gcc/testsuite/gfortran.dg/pr103367_4.f90
*** gcc-13-20260708/gcc/testsuite/gfortran.dg/pr103367_4.f90	Thu Jan  1 00:00:00 1970
--- gcc-13-20260715/gcc/testsuite/gfortran.dg/pr103367_4.f90	Wed Jul 15 22:32:14 2026
***************
*** 0 ****
--- 1,14 ----
+ ! { dg-do run }
+ ! PR103367, this test previously
+ ! Test case from the PR segfaulted at compile time.
+ program p
+   type inner
+     integer :: n = 3
+   end type
+   type outer
+     type(inner) :: a(2) = inner(1)
+   end type
+   type(outer), parameter :: x(1) = outer(inner(4))
+   integer, parameter :: y(2) = x(1)%a%n
+   if (any (y /= [4, 4])) stop 1
+ end
diff -Nrcpad gcc-13-20260708/gcc/tree-sra.cc gcc-13-20260715/gcc/tree-sra.cc
*** gcc-13-20260708/gcc/tree-sra.cc	Wed Jul  8 22:32:15 2026
--- gcc-13-20260715/gcc/tree-sra.cc	Wed Jul 15 22:32:15 2026
*************** build_debug_ref_for_model (location_t lo
*** 1928,1943 ****
  }
  
  /* Construct a memory reference consisting of component_refs and array_refs to
!    a part of an aggregate *RES (which is of type TYPE).  The requested part
!    should have type EXP_TYPE at be the given OFFSET.  This function might not
!    succeed, it returns true when it does and only then *RES points to something
!    meaningful.  This function should be used only to build expressions that we
!    might need to present to user (e.g. in warnings).  In all other situations,
     build_ref_for_model or build_ref_for_offset should be used instead.  */
  
  static bool
  build_user_friendly_ref_for_offset (tree *res, tree type, HOST_WIDE_INT offset,
! 				    tree exp_type)
  {
    while (1)
      {
--- 1928,1947 ----
  }
  
  /* Construct a memory reference consisting of component_refs and array_refs to
!    a part of an aggregate *RES which is of type TYPE.  The requested part
!    should have type EXP_TYPE at the given OFFSET.  CUR_SIZE must be the size of
!    *RES unless it is known that *RES alone cannot be the result.  This function
!    might not succeed, it returns true when it does and only then *RES points to
!    something meaningful.
! 
!    This function should be used only to build expressions that we might need to
!    present to user (e.g. in warnings).  In all other situations,
     build_ref_for_model or build_ref_for_offset should be used instead.  */
  
  static bool
  build_user_friendly_ref_for_offset (tree *res, tree type, HOST_WIDE_INT offset,
! 				    HOST_WIDE_INT cur_size, tree exp_type,
! 				    HOST_WIDE_INT exp_size)
  {
    while (1)
      {
*************** build_user_friendly_ref_for_offset (tree
*** 1945,1951 ****
        tree tr_size, index, minidx;
        HOST_WIDE_INT el_size;
  
!       if (offset == 0 && exp_type
  	  && types_compatible_p (exp_type, type))
  	return true;
  
--- 1949,1956 ----
        tree tr_size, index, minidx;
        HOST_WIDE_INT el_size;
  
!       if (offset == 0
! 	  && cur_size == exp_size
  	  && types_compatible_p (exp_type, type))
  	return true;
  
*************** build_user_friendly_ref_for_offset (tree
*** 1983,1989 ****
  			     NULL_TREE);
  	      expr_ptr = &expr;
  	      if (build_user_friendly_ref_for_offset (expr_ptr, TREE_TYPE (fld),
! 						      offset - pos, exp_type))
  		{
  		  *res = expr;
  		  return true;
--- 1988,1995 ----
  			     NULL_TREE);
  	      expr_ptr = &expr;
  	      if (build_user_friendly_ref_for_offset (expr_ptr, TREE_TYPE (fld),
! 						      offset - pos, size,
! 						      exp_type, exp_size))
  		{
  		  *res = expr;
  		  return true;
*************** build_user_friendly_ref_for_offset (tree
*** 2006,2022 ****
  	  *res = build4 (ARRAY_REF, TREE_TYPE (type), *res, index,
  			 NULL_TREE, NULL_TREE);
  	  offset = offset % el_size;
  	  type = TREE_TYPE (type);
  	  break;
  
  	default:
! 	  if (offset != 0)
! 	    return false;
! 
! 	  if (exp_type)
! 	    return false;
! 	  else
! 	    return true;
  	}
      }
  }
--- 2012,2023 ----
  	  *res = build4 (ARRAY_REF, TREE_TYPE (type), *res, index,
  			 NULL_TREE, NULL_TREE);
  	  offset = offset % el_size;
+ 	  cur_size = el_size;
  	  type = TREE_TYPE (type);
  	  break;
  
  	default:
! 	  return false;
  	}
      }
  }
*************** create_artificial_child_access (struct a
*** 2852,2858 ****
    struct access *access = access_pool.allocate ();
    memset (access, 0, sizeof (struct access));
    if (!build_user_friendly_ref_for_offset (&expr, TREE_TYPE (expr), new_offset,
! 					   model->type))
      {
        access->grp_no_warning = true;
        expr = build_ref_for_model (EXPR_LOCATION (parent->base), parent->base,
--- 2853,2860 ----
    struct access *access = access_pool.allocate ();
    memset (access, 0, sizeof (struct access));
    if (!build_user_friendly_ref_for_offset (&expr, TREE_TYPE (expr), new_offset,
! 					   parent->size, model->type,
! 					   model->size))
      {
        access->grp_no_warning = true;
        expr = build_ref_for_model (EXPR_LOCATION (parent->base), parent->base,
*************** propagate_subaccesses_from_rhs (struct a
*** 2991,2998 ****
  	  tree t = lacc->base;
  
  	  lacc->type = racc->type;
  	  if (build_user_friendly_ref_for_offset (&t, TREE_TYPE (t),
! 						  lacc->offset, racc->type))
  	    {
  	      lacc->expr = t;
  	      lacc->grp_same_access_path = true;
--- 2993,3003 ----
  	  tree t = lacc->base;
  
  	  lacc->type = racc->type;
+ 	  /* We know racc and lacc are of different types so can pass -1 as
+ 	     cur_size.  */
  	  if (build_user_friendly_ref_for_offset (&t, TREE_TYPE (t),
! 						  lacc->offset, -1,
! 						  racc->type, racc->size))
  	    {
  	      lacc->expr = t;
  	      lacc->grp_same_access_path = true;
*************** propagate_subaccesses_from_rhs (struct a
*** 3050,3056 ****
  	}
  
        if (rchild->grp_unscalarizable_region
- 	  || (rchild->size % BITS_PER_UNIT) != 0
  	  || !budget_for_propagation_access (lacc->base))
  	{
  	  if (!lacc->grp_write && access_or_its_child_written (rchild))
--- 3055,3060 ----
*************** propagate_subaccesses_from_lhs (struct a
*** 3110,3116 ****
        HOST_WIDE_INT norm_offset = lchild->offset + norm_delta;
  
        if (lchild->grp_unscalarizable_region
- 	  || (lchild->size % BITS_PER_UNIT) != 0
  	  || child_would_conflict_in_acc (racc, norm_offset, lchild->size,
  					  &matching_acc)
  	  || !budget_for_propagation_access (racc->base))
--- 3114,3119 ----
