https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116661

            Bug ID: 116661
           Summary: Undefined behavior when compiling interop-1.f90 gomp
                    test
           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: burnus at gcc dot gnu.org
            Blocks: 63426
  Target Milestone: ---
              Host: x86_64-linux-gnu
            Target: x86_64-linux-gnu

After bootstrapping (GCC master revision r15-3544-g2067df800df930)
with UBSAN enabled, using the following configure line:

  ../src/configure --prefix=/tmp/gcc/inst --enable-languages=c,c++,fortran
--enable-checking=release --disable-multilib --enable-host-shared
--with-build-config=bootstrap-ubsan

And then running the gfortran.dg/gomp/interop-1.f90 test:

  make -k check-fortran RUNTESTFLAGS="gomp.exp=interop-1.f90"

I see the following UBSAN complaints:

  /home/mjambor/gcc/mine/src/gcc/fortran/resolve.cc:7645:23: runtime error:
member access within misaligned address 0x0000091393e5 for type 'struct
gfc_expr', which requires 8 byte alignment
  0x0000091393e5: note: pointer points here
   20 25 43 00 70 72 65  66 65 72 5f 74 79 70 65  20 28 20 00 45 78 70 65  63
74 65 64 20 25 3c 2c  25
             ^ 
  /home/mjambor/gcc/mine/src/gcc/fortran/resolve.cc:7653:10: runtime error:
member access within misaligned address 0x0000091393e5 for type 'struct
gfc_expr', which requires 8 byte alignment
  0x0000091393e5: note: pointer points here
   20 25 43 00 70 72 65  66 65 72 5f 74 79 70 65  20 28 20 00 45 78 70 65  63
74 65 64 20 25 3c 2c  25
             ^ 
  /home/mjambor/gcc/mine/src/gcc/fortran/resolve.cc:7653:10: runtime error:
load of value 1717924464, which is not a valid value for type 'expr_t'
  /home/mjambor/gcc/mine/src/gcc/fortran/resolve.cc:7668:14: runtime error:
member access within misaligned address 0x0000091393e5 for type 'struct
gfc_expr', which requires 8 byte alignment
  0x0000091393e5: note: pointer points here
   20 25 43 00 70 72 65  66 65 72 5f 74 79 70 65  20 28 20 00 45 78 70 65  63
74 65 64 20 25 3c 2c  25
             ^ 
  /home/mjambor/gcc/mine/src/gcc/fortran/resolve.cc:7668:14: runtime error:
load of value 1717924464, which is not a valid value for type 'expr_t'
  compiler exited with status 1

Especially the "load of value 1717924464" issue should be
detectable with an added assert very easily, which should help
avoid the lengthy UBSAN bootstrap process.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63426
[Bug 63426] [meta-bug] Issues found with -fsanitize=undefined

Reply via email to