https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118683
Bug ID: 118683
Summary: UBSAN: Invalid value for type ar_type since
r15-7070-g0d1e62b83561ba
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: jamborm at gcc dot gnu.org
CC: anlauf at gcc dot gnu.org
Blocks: 63426
Target Milestone: ---
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu
With UBSAN instrumented compiler, compiling the testcase
gfortran.dg/pr81978.f90 at -O3 -g fails with:
/home/worker/buildworker/tiber-gcc-ubsan/build/gcc/fortran/trans-expr.cc:7499:19:
runtime error: load of value 960134032, which is not a valid value for type
'ar_type'
To configure the compiler with UBSAN, bootstrap it with option
--with-build-config=bootstrap-ubsan (we also only do release checking).
The failure started with commit r15-7070-g0d1e62b83561ba which however
introduced the testcase:
Author: Harald Anlauf <[email protected]>
Date: Sun Jan 19 21:06:56 2025 +0100
Fortran: do not copy back for parameter actual arguments [PR81978]
When an array is packed for passing as an actual argument, and the array
has the PARAMETER attribute (i.e., it is a named constant that can reside
in read-only memory), do not copy back (unpack) from the temporary.
PR fortran/81978
gcc/fortran/ChangeLog:
* trans-array.cc (gfc_conv_array_parameter): Do not copy back data
if actual array parameter has the PARAMETER attribute.
* trans-expr.cc (gfc_conv_subref_array_arg): Likewise.
gcc/testsuite/ChangeLog:
* gfortran.dg/pr81978.f90: New test.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63426
[Bug 63426] [meta-bug] Issues found with -fsanitize=undefined