The following program doesn't generate a trap AFAICT, even though there is a
signed overflow on a multiplication

 CALL FOO(1000000)
 END
 SUBROUTINE FOO(a)
  INTEGER :: a
  write(6,*) a*a
 END SUBROUTINE FOO

> gfortran -ftrapv test.f90
> ./a.out
  -727379968

fails for both
gcc version 4.4.0 20090414 (prerelease) [gcc-4_4-branch revision 146034] (GCC)
gcc version 4.5.0 20090414 (experimental) [trunk revision 146031] (GCC)


-- 
           Summary: ftrapv does not work
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jv244 at cam dot ac dot uk
GCC target triplet: x86_64-unknown-linux-gnu


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

Reply via email to