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

            Bug ID: 68717
           Summary: [6 Regression] New (bogus?) warnings when compiling
                    some gfortran.dg tests with -flto after r231239
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dominiq at lps dot ens.fr
                CC: hubicka at gcc dot gnu.org
  Target Milestone: ---

The following tests fail when compiled with -flto after r231239

FAIL: gfortran.dg/assumed_rank_1.f90   -g -flto  (test for excess errors)
FAIL: gfortran.dg/assumed_rank_8.f90   -g -flto  (test for excess errors)
FAIL: gfortran.dg/assumed_rank_9.f90   -g -flto  (test for excess errors)
FAIL: gfortran.dg/assumed_rank_2.f90   -g -flto  (test for excess errors)
FAIL: gfortran.dg/cshift_large_1.f90   -g -flto  (test for excess errors)
FAIL: gfortran.dg/elemental_subroutine_3.f90   -g -flto  (test for excess
errors)
FAIL: gfortran.dg/eoshift_large_1.f90   -g -flto  (test for excess errors)
FAIL: gfortran.dg/func_derived_1.f90   -g -flto  (test for excess errors)
FAIL: gfortran.dg/matmul_3.f90   -g -flto  (test for excess errors)
FAIL: gfortran.dg/matmul_6.f90   -g -flto  (test for excess errors)
FAIL: gfortran.dg/reshape-complex.f90   -g -flto  (test for excess errors)
FAIL: gfortran.dg/zero_sized_1.f90   -g -flto  (test for excess errors)

with both -m32 and -m64, the following two tests are only compiled with -m64
and fail

FAIL: gfortran.dg/cshift_large_1.f90   -g -flto  (test for excess errors)
FAIL: gfortran.dg/eoshift_large_1.f90   -g -flto  (test for excess errors)

The typical error is

/opt/gcc/_clean/gcc/testsuite/gfortran.dg/matmul_3.f90:22:0: warning: type of
'_gfortran_matmul_i4' does not match original declaration [-Wlto-type-mismatch]
    iX2(1:n,1) = matmul( iB(2,1:n),iC(1:n,1:n) )


/opt/gcc/_clean/gcc/testsuite/gfortran.dg/matmul_3.f90:22:0: warning: type of
'_gfortran_matmul_i4' does not match original declaration [-Wlto-type-mismatch]
/opt/gcc/_clean/gcc/testsuite/gfortran.dg/matmul_3.f90:33:0: note:
'_gfortran_matmul_i4' was previously declared here
    iX2 = matmul (transpose (iB), iC)


/opt/gcc/_clean/gcc/testsuite/gfortran.dg/matmul_3.f90:33:0: note: code may be
misoptimized unless -fno-strict-aliasing is used

The warnings do not require -fstrict-aliasing and are not suppressed with
-fno-strict-aliasing (as it is the case for pr68649).

These -flto failures are detected by using the following patch

--- ../_clean/gcc/testsuite/lib/gfortran-dg.exp 2015-05-16 15:02:44.000000000
+0200
+++ ../p_work/gcc/testsuite/lib/gfortran-dg.exp 2015-05-16 15:03:53.000000000
+0200
@@ -125,8 +125,18 @@ proc gfortran-dg-runtest { testcases fla
        # we cycle through the option list, otherwise we don't
        if [expr [search_for $test "dg-do run"]] {
            set option_list $torture_with_loops
+            if [check_effective_target_lto] {
+               lappend option_list { -g -flto }
+               # lappend option_list { -g -O3 -fwhole-program -flto }
+            }
        } else {
            set option_list [list { -O } ]
+           if [check_effective_target_lto] {
+               # lappend option_list { -g -flto }
+               # lappend option_list { -g -O3 -fwhole-program -flto }
+               # lappend option_list { -flto }
+               # lappend option_list { -O3 -fwhole-program -flto }
+           }
        }

        set nshort [file tail [file dirname $test]]/[file tail $test]

Reply via email to