[Bug fortran/57616] New: Support -fsanitize=undefined in Fortran

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 14 20:43:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57616

            Bug ID: 57616
           Summary: Support -fsanitize=undefined in Fortran
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org

The newly being added patches for -fsanitize=undefined are partially done in
the the FE. Thus, we need to add some Fortran support for them.

Seemingly, the following should be handled:
* Integer divide by zero
* Invalid bit shifts


Fortran 2008 has for shift:

13.7.50 DSHIFTL (I, J, SHIFT)
13.7.51 DSHIFTR (I, J, SHIFT)
...
SHIFT   shall be of type integer. It shall be nonnegative and less than or
equal to BIT_SIZE (I) if I is of type integer; otherwise, it shall be less than
or equal to BIT_SIZE (J).

13.7.84 ISHFT (I, SHIFT)
...
SHIFT   shall be of type integer. The absolute value of SHIFT shall be less
than or equal to BIT_SIZE (I).

13.7.85 ISHFTC (I, SHIFT [, SIZE])
...
SIZE (optional) shall be of type integer. The value of SIZE shall be positive
and shall not exceed BIT SIZE (I).

13.7.150 SHIFTA (I, SHIFT)
13.7.151 SHIFTL (I, SHIFT)
13.7.151 SHIFTR (I, SHIFT)
...
SHIFT shall be of type integer. It shall be nonnegative and less than or equal
to BIT SIZE (I).



More information about the Gcc-bugs mailing list