Patchwork [Fortran] RFC: Enabling -fwhole-file by default

login
register
mail settings
Submitter Tobias Burnus
Date July 23, 2010, 4:04 p.m.
Message ID <4C49BD88.5060108@net-b.de>
Download mbox | patch
Permalink /patch/59815/
State New
Headers show

Comments

Tobias Burnus - July 23, 2010, 4:04 p.m.
I would like to enable -fwhole-file by default. As written before, the
advantages are

- Fixes some wrong-code issues (e.g. PR 44945)
- Improves diagnostic
- Improves (non-LTO) optimizations
- More consistent codepath: The same for default, LTO and -fwhole-program


I think -fwhole-file is now stable enough to be enabled by default; one
can still use -fno-whole-file to disable it. (Though, I like to remove
that "no" option in the next release, i.e. 4.7.)

Before one can enable -fwhole-file, one should apply the following two
patches:
http://gcc.gnu.org/ml/fortran/2010-07/msg00311.html
http://gcc.gnu.org/ml/fortran/2010-07/msg00320.html

In addition, some changes to the test suite were necessary: Some changed
messages due to the different code path, a bunch of warnings, some code
fixes - see attached patch.

With the two patches mentioned above and the attached patch, I only see
one test-suite failure:
  gfortran.dg/common_resize_1.f
where a warning about different COMMON sizes disappears with
-fwhole-file (cf. PR 45045 and related PR 45044). I would suggest to
XFAIL that check if we cannot fix it soon.

The change to the compare_parameter is for gfortran.dg/hollerith.f90;
otherwise, one gets the warning: "Type mismatch in argument 'h' at (1);
passed HOLLERITH to INTEGER(8)". I think this warning does not make much
sense for Hollerith (enabled by default; error with -pedantic)  - and
with -pedantic one already gets warnings - e.g. for the line in question
a "Hollerith constant" warning.

Build and regtested on x86-64-linux - with common_resize_1.f as only
failure.
OK for the trunk?

Jakub might want to have a look at the libgomp/testsuite/ change.

Tobias

PS: If it is OK, I will write a changelog.

 gcc/fortran/interface.c                                        |    1
 gcc/fortran/options.c                                          |    2
 gcc/testsuite/gfortran.dg/bounds_check_strlen_1.f90            |    2
 gcc/testsuite/gfortran.dg/bounds_temporaries_1.f90             |    2
 gcc/testsuite/gfortran.dg/char_array_structure_constructor.f90 |    5 +
 gcc/testsuite/gfortran.dg/entry_17.f90                         |    4
 gcc/testsuite/gfortran.dg/func_decl_4.f90                      |   13 ++-
 gcc/testsuite/gfortran.dg/func_decl_5.f90                      |   15 +++
 gcc/testsuite/gfortran.dg/g77/19990218-0.f                     |    2
 gcc/testsuite/gfortran.dg/g77/19990218-1.f                     |    2
 gcc/testsuite/gfortran.dg/g77/970625-2.f                       |    2
 gcc/testsuite/gfortran.dg/generic_actual_arg.f90               |    2
 gcc/testsuite/gfortran.dg/global_references_1.f90              |    6 -
 gcc/testsuite/gfortran.dg/integer_exponentiation_2.f90         |   20 ++--
 gcc/testsuite/gfortran.dg/intrinsic_std_1.f90                  |   16 +--
 gcc/testsuite/gfortran.dg/intrinsic_std_6.f90                  |   41
++++++++++
 gcc/testsuite/gfortran.dg/loc_1.f90                            |    3
 gcc/testsuite/gfortran.dg/pr20865.f90                          |    2
 gcc/testsuite/gfortran.dg/pr37243.f                            |    6 -
 gcc/testsuite/gfortran.dg/sizeof.f90                           |    4
 gcc/testsuite/gfortran.dg/use_only_1.f90                       |    1
 gcc/testsuite/gfortran.dg/used_before_typed_4.f90              |    2
 libgomp/testsuite/libgomp.fortran/appendix-a/a.28.5.f90        |    5 +
 23 files changed, 115 insertions(+), 43 deletions(-)
Paul Richard Thomas - July 23, 2010, 7:15 p.m.
Dear Tobias,

Many thanks to you for completing this job.  It is one amongst many
that I would have liked to have done myself.

On Fri, Jul 23, 2010 at 6:04 PM, Tobias Burnus <burnus@net-b.de> wrote:
> I would like to enable -fwhole-file by default. As written before, the
> advantages are
>
> - Fixes some wrong-code issues (e.g. PR 44945)
> - Improves diagnostic
> - Improves (non-LTO) optimizations
> - More consistent codepath: The same for default, LTO and -fwhole-program
>
>
> I think -fwhole-file is now stable enough to be enabled by default; one
> can still use -fno-whole-file to disable it. (Though, I like to remove
> that "no" option in the next release, i.e. 4.7.)

I don't think that I can agree to that, largely for legacy reasons.  I
see no harm in leaving the option and would suggest that for
std=legacy it is automatically set.

Anyway, it's for discussion :-)

>
> Before one can enable -fwhole-file, one should apply the following two
> patches:
> http://gcc.gnu.org/ml/fortran/2010-07/msg00311.html
> http://gcc.gnu.org/ml/fortran/2010-07/msg00320.html
>
> In addition, some changes to the test suite were necessary: Some changed
> messages due to the different code path, a bunch of warnings, some code
> fixes - see attached patch.

The patch brings back lots of memories - I did the same at one stage.

>
> With the two patches mentioned above and the attached patch, I only see
> one test-suite failure:
>  gfortran.dg/common_resize_1.f
> where a warning about different COMMON sizes disappears with
> -fwhole-file (cf. PR 45045 and related PR 45044). I would suggest to
> XFAIL that check if we cannot fix it soon.

mmm!  I am not sure that I like that.  I wonder why it happens?
Remind me in a couple of weeks, when I am back from vacation.
>
> The change to the compare_parameter is for gfortran.dg/hollerith.f90;
> otherwise, one gets the warning: "Type mismatch in argument 'h' at (1);
> passed HOLLERITH to INTEGER(8)". I think this warning does not make much
> sense for Hollerith (enabled by default; error with -pedantic)  - and
> with -pedantic one already gets warnings - e.g. for the line in question
> a "Hollerith constant" warning.
>
> Build and regtested on x86-64-linux - with common_resize_1.f as only
> failure.
> OK for the trunk?

I think that we should try and fix the failure.  It's most odd that it
should appear with -fwhole-file.  Maybe the XFAIL is good but make
sure that we all remember it.

>
> Jakub might want to have a look at the libgomp/testsuite/ change.
>
> Tobias
>
> PS: If it is OK, I will write a changelog.

Write the ChangeLog  and get it committed!

OK for trunk :-)

Paul

>
>  gcc/fortran/interface.c                                        |    1
>  gcc/fortran/options.c                                          |    2
>  gcc/testsuite/gfortran.dg/bounds_check_strlen_1.f90            |    2
>  gcc/testsuite/gfortran.dg/bounds_temporaries_1.f90             |    2
>  gcc/testsuite/gfortran.dg/char_array_structure_constructor.f90 |    5 +
>  gcc/testsuite/gfortran.dg/entry_17.f90                         |    4
>  gcc/testsuite/gfortran.dg/func_decl_4.f90                      |   13 ++-
>  gcc/testsuite/gfortran.dg/func_decl_5.f90                      |   15 +++
>  gcc/testsuite/gfortran.dg/g77/19990218-0.f                     |    2
>  gcc/testsuite/gfortran.dg/g77/19990218-1.f                     |    2
>  gcc/testsuite/gfortran.dg/g77/970625-2.f                       |    2
>  gcc/testsuite/gfortran.dg/generic_actual_arg.f90               |    2
>  gcc/testsuite/gfortran.dg/global_references_1.f90              |    6 -
>  gcc/testsuite/gfortran.dg/integer_exponentiation_2.f90         |   20 ++--
>  gcc/testsuite/gfortran.dg/intrinsic_std_1.f90                  |   16 +--
>  gcc/testsuite/gfortran.dg/intrinsic_std_6.f90                  |   41
> ++++++++++
>  gcc/testsuite/gfortran.dg/loc_1.f90                            |    3
>  gcc/testsuite/gfortran.dg/pr20865.f90                          |    2
>  gcc/testsuite/gfortran.dg/pr37243.f                            |    6 -
>  gcc/testsuite/gfortran.dg/sizeof.f90                           |    4
>  gcc/testsuite/gfortran.dg/use_only_1.f90                       |    1
>  gcc/testsuite/gfortran.dg/used_before_typed_4.f90              |    2
>  libgomp/testsuite/libgomp.fortran/appendix-a/a.28.5.f90        |    5 +
>  23 files changed, 115 insertions(+), 43 deletions(-)
>
Steven Bosscher - July 23, 2010, 7:18 p.m.
On Fri, Jul 23, 2010 at 9:15 PM, Paul Richard Thomas
<paul.richard.thomas@gmail.com> wrote:
>> I think -fwhole-file is now stable enough to be enabled by default; one
>> can still use -fno-whole-file to disable it. (Though, I like to remove
>> that "no" option in the next release, i.e. 4.7.)
>
> I don't think that I can agree to that, largely for legacy reasons.  I
> see no harm in leaving the option and would suggest that for
> std=legacy it is automatically set.

I think this should also depend on whether there are still all those
middle-end hacks we used to have for the -fno-whole-file case. Honza?

Ciao!
Steven
Richard Guenther - July 23, 2010, 7:48 p.m.
On Fri, Jul 23, 2010 at 9:18 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> On Fri, Jul 23, 2010 at 9:15 PM, Paul Richard Thomas
> <paul.richard.thomas@gmail.com> wrote:
>>> I think -fwhole-file is now stable enough to be enabled by default; one
>>> can still use -fno-whole-file to disable it. (Though, I like to remove
>>> that "no" option in the next release, i.e. 4.7.)
>>
>> I don't think that I can agree to that, largely for legacy reasons.  I
>> see no harm in leaving the option and would suggest that for
>> std=legacy it is automatically set.
>
> I think this should also depend on whether there are still all those
> middle-end hacks we used to have for the -fno-whole-file case. Honza?

We don't have any - we always just miscompiled stuff.

Richard.
Steven Bosscher - July 23, 2010, 7:54 p.m.
On Fri, Jul 23, 2010 at 9:48 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Fri, Jul 23, 2010 at 9:18 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
>> On Fri, Jul 23, 2010 at 9:15 PM, Paul Richard Thomas
>> <paul.richard.thomas@gmail.com> wrote:
>>>> I think -fwhole-file is now stable enough to be enabled by default; one
>>>> can still use -fno-whole-file to disable it. (Though, I like to remove
>>>> that "no" option in the next release, i.e. 4.7.)
>>>
>>> I don't think that I can agree to that, largely for legacy reasons.  I
>>> see no harm in leaving the option and would suggest that for
>>> std=legacy it is automatically set.
>>
>> I think this should also depend on whether there are still all those
>> middle-end hacks we used to have for the -fno-whole-file case. Honza?
>
> We don't have any - we always just miscompiled stuff.

ISTR there is special code in the call graph construction, to handle
multiple function decls...?

Ciao!
Steven
Richard Guenther - July 23, 2010, 7:58 p.m.
On Fri, Jul 23, 2010 at 9:54 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> On Fri, Jul 23, 2010 at 9:48 PM, Richard Guenther
> <richard.guenther@gmail.com> wrote:
>> On Fri, Jul 23, 2010 at 9:18 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
>>> On Fri, Jul 23, 2010 at 9:15 PM, Paul Richard Thomas
>>> <paul.richard.thomas@gmail.com> wrote:
>>>>> I think -fwhole-file is now stable enough to be enabled by default; one
>>>>> can still use -fno-whole-file to disable it. (Though, I like to remove
>>>>> that "no" option in the next release, i.e. 4.7.)
>>>>
>>>> I don't think that I can agree to that, largely for legacy reasons.  I
>>>> see no harm in leaving the option and would suggest that for
>>>> std=legacy it is automatically set.
>>>
>>> I think this should also depend on whether there are still all those
>>> middle-end hacks we used to have for the -fno-whole-file case. Honza?
>>
>> We don't have any - we always just miscompiled stuff.
>
> ISTR there is special code in the call graph construction, to handle
> multiple function decls...?

No, we get distinct cgraph nodes for them (and thus callers and callees
are messed up).

Richard.

> Ciao!
> Steven
>
Tobias Burnus - July 23, 2010, 8:04 p.m.
Paul Richard Thomas wrote:
>> I think -fwhole-file is now stable enough to be enabled by default; one
>> can still use -fno-whole-file to disable it. (Though, I like to remove
>> that "no" option in the next release, i.e. 4.7.)
> 
> I don't think that I can agree to that, largely for legacy reasons.  I
> see no harm in leaving the option and would suggest that for
> std=legacy it is automatically set.

I am against setting -fno-whole-file for -std=legacy: Without
-fwhole-file gfortran generate wrong declarations, which cause the
middle end to do wrong alias/dependency analysis. I think problems that
pop up should be solved differently - not by falling back to generating
multiple declarations. But let's see first how many problems pop up; its
more still more one year until GCC 4.7's stage3 ends ...

>> With the two patches mentioned above and the attached patch, I only see
>> one test-suite failure:
>>  gfortran.dg/common_resize_1.f
>> where a warning about different COMMON sizes disappears with
>> -fwhole-file (cf. PR 45045 and related PR 45044). I would suggest to
>> XFAIL that check if we cannot fix it soon.
> 
> mmm!  I am not sure that I like that.  I wonder why it happens?
> Remind me in a couple of weeks, when I am back from vacation.
>
> I think that we should try and fix the failure.  It's most odd that it
> should appear with -fwhole-file.  Maybe the XFAIL is good but make
> sure that we all remember it.

I wonder whether the -fwhole-file issue and the order issue is one and
the same bug or whether those are two independent bugs. But as we have
two open PRs for the XFAIL we shouldn't forget it.

>> Jakub might want to have a look at the libgomp/testsuite/ change.

> Write the ChangeLog  and get it committed!
> OK for trunk :-)

Thanks for the review!


Steven Bosscher wrote:
> I think this should also depend on whether there are still all those
> middle-end hacks we used to have for the -fno-whole-file case. Honza?

I think there are no middle-end hacks for -fno-whole-file. But as I do
know the middle end well, nor its history, I am likely wrong. I know
that there are some hacks for wrong decls _with_ -fwhole-file for LTO.
Some of the problems of the "wrong" decls are unavoidable given how the
C/Fortran/... languages are standardized.* The other decl issues should
be solved.

Tobias

* I am thinking of unnamed commons which can be of variable length or
"void *" ("type(c_ptr)") being the only C interoperable pointer data
type in Fortran.
Jerry DeLisle - July 23, 2010, 10:36 p.m.
On 07/23/2010 01:04 PM, Tobias Burnus wrote:
> Paul Richard Thomas wrote:
>>> I think -fwhole-file is now stable enough to be enabled by default; one
>>> can still use -fno-whole-file to disable it. (Though, I like to remove
>>> that "no" option in the next release, i.e. 4.7.)

There appears to remain a CP2K issue.  I suggest that get fixed first.  Reducing 
it is going to be a problem, maybe.

Jerry
Steven Bosscher - July 23, 2010, 10:45 p.m.
On Sat, Jul 24, 2010 at 12:36 AM, Jerry DeLisle <jvdelisle@verizon.net> wrote:
> On 07/23/2010 01:04 PM, Tobias Burnus wrote:
>>
>> Paul Richard Thomas wrote:
>>>>
>>>> I think -fwhole-file is now stable enough to be enabled by default; one
>>>> can still use -fno-whole-file to disable it. (Though, I like to remove
>>>> that "no" option in the next release, i.e. 4.7.)
>
> There appears to remain a CP2K issue.  I suggest that get fixed first.
>  Reducing it is going to be a problem, maybe.

Does anyone have scripts for delta that work well for Fortran? If so,
then we can set up a delta run on one of the big fast machines in the
compile farm and see what comes out.

Ciao!
Steven
Tobias Burnus - July 23, 2010, 11:07 p.m.
Steven Bosscher wrote:
> On Sat, Jul 24, 2010 at 12:36 AM, Jerry DeLisle <jvdelisle@verizon.net> wrote:
>   
>> There appears to remain a CP2K issue.  I suggest that get fixed first.
>>  Reducing it is going to be a problem, maybe.
>>     
> Does anyone have scripts for delta that work well for Fortran? If so,
> then we can set up a delta run on one of the big fast machines in the
> compile farm and see what comes out.
>   

I think it works reasonably well, but there exists also a patched
version, cf. http://gcc.gnu.org/wiki/A_guide_to_testcase_reduction
(One should remember to first remove the comment lines "^ *!" and the
empty lines.)

The test case itself is at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40011#c59

Tobias,
who has no compile-farm account.

Patch

Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c	(revision 162456)
+++ gcc/fortran/interface.c	(working copy)
@@ -1470,6 +1470,7 @@  compare_parameter (gfc_symbol *formal, g
     }
 
   if ((actual->expr_type != EXPR_NULL || actual->ts.type != BT_UNKNOWN)
+      && actual->ts.type != BT_HOLLERITH
       && !gfc_compare_types (&formal->ts, &actual->ts))
     {
       if (where)
Index: gcc/fortran/options.c
===================================================================
--- gcc/fortran/options.c	(revision 162456)
+++ gcc/fortran/options.c	(working copy)
@@ -96,7 +96,7 @@  gfc_init_options (unsigned int argc, con
   gfc_option.flag_default_real = 0;
   gfc_option.flag_dollar_ok = 0;
   gfc_option.flag_underscoring = 1;
-  gfc_option.flag_whole_file = 0;
+  gfc_option.flag_whole_file = 1;
   gfc_option.flag_f2c = 0;
   gfc_option.flag_second_underscore = -1;
   gfc_option.flag_implicit_none = 0;
Index: gcc/testsuite/gfortran.dg/func_decl_4.f90
===================================================================
--- gcc/testsuite/gfortran.dg/func_decl_4.f90	(revision 162456)
+++ gcc/testsuite/gfortran.dg/func_decl_4.f90	(working copy)
@@ -3,13 +3,18 @@ 
 !
 ! Functions shall not have an initializer.
 !
+! Due to -fwhole-file, the function declaration
+! warnings come before the init warnings; thus
+! the warning for the WRONG lines have been moved to
+! func_decl_5.f90
+!
 
-function f1()                      ! { dg-error "cannot have an initializer" }
-  integer :: f1 = 42
+function f1()
+  integer :: f1 = 42 ! WRONG, see  func_decl_5.f90
 end function
 
-function f2() RESULT (r)           ! { dg-error "cannot have an initializer" }
-  integer :: r = 42
+function f2() RESULT (r)
+  integer :: r = 42 ! WRONG, see func_decl_5.f90
 end function
 
 function f3() RESULT (f3)          ! { dg-error "must be different than function name" }
Index: gcc/testsuite/gfortran.dg/intrinsic_std_6.f90
===================================================================
--- gcc/testsuite/gfortran.dg/intrinsic_std_6.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/intrinsic_std_6.f90	(revision 0)
@@ -0,0 +1,41 @@ 
+! { dg-do compile }
+! { dg-options "-std=f95 -Wintrinsics-std -fdump-tree-original" }
+
+!
+! See intrinsic_std_1.f90 for more compile-time checks
+!
+
+! PR fortran/33141
+! Check for the expected behaviour when an intrinsic function/subroutine is
+! called that is not available in the defined standard or that is a GNU
+! extension:
+! There should be a warning emitted on the call, and the reference should be
+! treated like an external call.
+! For declaring a non-standard intrinsic INTRINSIC, a hard error should be
+! generated, of course.
+
+SUBROUTINE no_implicit
+  IMPLICIT NONE
+  REAL :: asinh ! { dg-warning "Fortran 2008" }
+
+  ! abort is a GNU extension
+  CALL abort () ! { dg-warning "extension" }
+
+  ! ASINH is an intrinsic of F2008
+  ! The warning should be issued in the declaration above where it is declared
+  ! EXTERNAL.
+  WRITE (*,*) ASINH (1.) ! { dg-warning "Fortran 2008" }
+END SUBROUTINE no_implicit
+
+SUBROUTINE implicit_type
+  ! acosh has implicit type
+
+  WRITE (*,*) ACOSH (1.) ! { dg-warning "Fortran 2008" }
+  WRITE (*,*) ACOSH (1.) ! { dg-bogus "Fortran 2008" }
+END SUBROUTINE implicit_type
+
+! Scan that really external functions are called.
+! { dg-final { scan-tree-dump " abort " "original" } }
+! { dg-final { scan-tree-dump " asinh " "original" } }
+! { dg-final { scan-tree-dump " acosh " "original" } }
+! { dg-final { cleanup-tree-dump "original" } }
Index: gcc/testsuite/gfortran.dg/bounds_temporaries_1.f90
===================================================================
--- gcc/testsuite/gfortran.dg/bounds_temporaries_1.f90	(revision 162456)
+++ gcc/testsuite/gfortran.dg/bounds_temporaries_1.f90	(working copy)
@@ -22,7 +22,7 @@  end subroutine gfcbug34
 ! This is PR25669
 subroutine foo (a)
   real a(*)
-  call bar (a, LBOUND(a),2)
+  call bar (a, LBOUND(a),2) ! { dg-warning "Rank mismatch in argument" }
 end subroutine foo
 subroutine bar (b, i, j)
   real b(i:j)
Index: gcc/testsuite/gfortran.dg/global_references_1.f90
===================================================================
--- gcc/testsuite/gfortran.dg/global_references_1.f90	(revision 162456)
+++ gcc/testsuite/gfortran.dg/global_references_1.f90	(working copy)
@@ -32,11 +32,11 @@  function h(x)       ! { dg-error "is alr
 end function h
 
 SUBROUTINE TT()
-  CHARACTER(LEN=10), EXTERNAL :: j
+  CHARACTER(LEN=10), EXTERNAL :: j ! { dg-warning "Return type mismatch" }
   CHARACTER(LEN=10)          :: T
 ! PR20881=========================================================== 
 ! Error only appears once but testsuite associates with both lines.
-  T = j () ! { dg-error "is already being used as a FUNCTION" }
+  T = j (1.0) ! { dg-error "is already being used as a SUBROUTINE" }
   print *, T
 END SUBROUTINE TT
 
@@ -78,7 +78,7 @@  end
 ! Lahey - 2636-S: "SOURCE.F90", line 81:
 ! Subroutine 'j' is previously referenced as a function in 'line 39'.
 
-SUBROUTINE j (x)    ! { dg-error "is already being used as a FUNCTION" }
+SUBROUTINE j (x)    ! { dg-error "is already being used as a SUBROUTINE" }
   integer a(10)
   common /bar/ a    ! Global entity foo
   real x
Index: gcc/testsuite/gfortran.dg/generic_actual_arg.f90
===================================================================
--- gcc/testsuite/gfortran.dg/generic_actual_arg.f90	(revision 162456)
+++ gcc/testsuite/gfortran.dg/generic_actual_arg.f90	(working copy)
@@ -37,7 +37,7 @@  USE TEST
 USE TEST2
 CALL F(CALCULATION)  ! { dg-error "GENERIC procedure" } 
 
-CALL F(CALCULATION2) ! OK because there is a same name specific 
+CALL F(CALCULATION2) ! OK because there is a same name specific, but: ! { dg-warning "More actual than formal arguments" }
 END
 
 SUBROUTINE F()
Index: gcc/testsuite/gfortran.dg/entry_17.f90
===================================================================
--- gcc/testsuite/gfortran.dg/entry_17.f90	(revision 162456)
+++ gcc/testsuite/gfortran.dg/entry_17.f90	(working copy)
@@ -24,7 +24,7 @@  function test3() ! { dg-warning "Obsoles
   return
 entry bar3()
   bar3 = ""
-end function test3 ! { dg-warning "Obsolescent feature" }
+end function test3
 
 function test4(n) ! { dg-error "returning variables of different string lengths" }
   integer  :: n
@@ -52,4 +52,4 @@  function test6() ! { dg-warning "Obsoles
   return
 entry bar6()
   bar6 = ""
-end function test6 ! { dg-warning "Obsolescent feature" }
+end function test6
Index: gcc/testsuite/gfortran.dg/used_before_typed_4.f90
===================================================================
--- gcc/testsuite/gfortran.dg/used_before_typed_4.f90	(revision 162456)
+++ gcc/testsuite/gfortran.dg/used_before_typed_4.f90	(working copy)
@@ -22,5 +22,5 @@  END SUBROUTINE test
 PROGRAM main
   IMPLICIT NONE
   INTEGER :: arr1(42), arr2(42)
-  CALL test (3, arr1, 2, arr2)
+  CALL test (3, arr1, 2, arr2) ! { dg-warning "Type mismatch in argument" }
 END PROGRAM main
Index: gcc/testsuite/gfortran.dg/bounds_check_strlen_1.f90
===================================================================
--- gcc/testsuite/gfortran.dg/bounds_check_strlen_1.f90	(revision 162456)
+++ gcc/testsuite/gfortran.dg/bounds_check_strlen_1.f90	(working copy)
@@ -12,7 +12,7 @@  END SUBROUTINE test
 
 PROGRAM main
   IMPLICIT NONE
-  CALL test ('abc') ! String is too short.
+  CALL test ('abc') ! { dg-warning "Character length of actual argument shorter" }
 END PROGRAM main
 
 ! { dg-output "shorter than the declared one for dummy argument 'str' \\(3/5\\)" }
Index: gcc/testsuite/gfortran.dg/char_array_structure_constructor.f90
===================================================================
--- gcc/testsuite/gfortran.dg/char_array_structure_constructor.f90	(revision 162456)
+++ gcc/testsuite/gfortran.dg/char_array_structure_constructor.f90	(working copy)
@@ -1,4 +1,9 @@ 
 ! { dg-do run }
+! { dg-options "-fwhole-file" }
+!
+! PR fortran/19107
+! -fwhole-file flag added for PR fortran/44945
+!
 ! This test the fix of PR19107, where character array actual
 ! arguments in derived type constructors caused an ICE.
 ! It also checks that the scalar counterparts are OK.
Index: gcc/testsuite/gfortran.dg/intrinsic_std_1.f90
===================================================================
--- gcc/testsuite/gfortran.dg/intrinsic_std_1.f90	(revision 162456)
+++ gcc/testsuite/gfortran.dg/intrinsic_std_1.f90	(working copy)
@@ -1,5 +1,9 @@ 
 ! { dg-do compile }
-! { dg-options "-std=f95 -Wintrinsics-std -fdump-tree-original" }
+! { dg-options "-std=f95 -Wintrinsics-std" }
+
+!
+! See intrinsic_std_6.f90 for the dump check.
+!
 
 ! PR fortran/33141
 ! Check for the expected behaviour when an intrinsic function/subroutine is
@@ -32,8 +36,8 @@  END SUBROUTINE implicit_type
 
 SUBROUTINE specification_expression
   CHARACTER(KIND=selected_char_kind("ascii")) :: x
-! { dg-error "must be an intrinsic function" "" { target "*-*-*" } 34 }
-! { dg-warning "Fortran 2003" "" { target "*-*-*" } 34 }
+! { dg-error "must be an intrinsic function" "" { target "*-*-*" } 38 }
+! { dg-warning "Fortran 2003" "" { target "*-*-*" } 38 }
 END SUBROUTINE specification_expression
 
 SUBROUTINE intrinsic_decl
@@ -41,9 +45,3 @@  SUBROUTINE intrinsic_decl
   INTRINSIC :: atanh ! { dg-error "Fortran 2008" }
   INTRINSIC :: abort ! { dg-error "extension" }
 END SUBROUTINE intrinsic_decl
-
-! Scan that really external functions are called.
-! { dg-final { scan-tree-dump " abort " "original" } }
-! { dg-final { scan-tree-dump " asinh " "original" } }
-! { dg-final { scan-tree-dump " acosh " "original" } }
-! { dg-final { cleanup-tree-dump "original" } }
Index: gcc/testsuite/gfortran.dg/func_decl_5.f90
===================================================================
--- gcc/testsuite/gfortran.dg/func_decl_5.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/func_decl_5.f90	(revision 0)
@@ -0,0 +1,15 @@ 
+! { dg-do compile }
+! { dg-options "-c" }
+!
+! Functions shall not have an initializer.
+!
+! Some tests were moved from func_decl_4.f90 to here.
+!
+
+function f1()                      ! { dg-error "cannot have an initializer" }
+  integer :: f1 = 42
+end function
+
+function f2() RESULT (r)           ! { dg-error "cannot have an initializer" }
+  integer :: r = 42
+end function
Index: gcc/testsuite/gfortran.dg/sizeof.f90
===================================================================
--- gcc/testsuite/gfortran.dg/sizeof.f90	(revision 162456)
+++ gcc/testsuite/gfortran.dg/sizeof.f90	(working copy)
@@ -82,7 +82,7 @@  subroutine check_derived ()
        call abort
 end subroutine check_derived
 
-call check_int ()
-call check_real ()
+call check_int (1)
+call check_real (1.0, (/1.0, 2.0, 3.0, 4.0, 5.0/))
 call check_derived ()
 end
Index: gcc/testsuite/gfortran.dg/pr20865.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr20865.f90	(revision 162456)
+++ gcc/testsuite/gfortran.dg/pr20865.f90	(working copy)
@@ -8,5 +8,5 @@ 
 
   integer :: i, st
   st(i) = (i*i+2)
-  call tt(st) ! { dg-error "Statement function .* is not allowed as an actual argument" }
+  call tt(st) ! { dg-error "Statement function .* is not allowed as an actual argument|Invalid procedure argument" }
   end
Index: gcc/testsuite/gfortran.dg/integer_exponentiation_2.f90
===================================================================
--- gcc/testsuite/gfortran.dg/integer_exponentiation_2.f90	(revision 162456)
+++ gcc/testsuite/gfortran.dg/integer_exponentiation_2.f90	(working copy)
@@ -139,16 +139,16 @@  subroutine foo(a)
   call gee_i(i**(-huge(0_4)))
   call gee_i(i**(-huge(0_4)-1_4))
 
-  call gee_i(i**0_8)
-  call gee_i(i**1_8)
-  call gee_i(i**2_8)
-  call gee_i(i**3_8)
-  call gee_i(i**(-1_8))
-  call gee_i(i**(-2_8))
-  call gee_i(i**(-3_8))
-  call gee_i(i**huge(0_8))
-  call gee_i(i**(-huge(0_8)))
-  call gee_i(i**(-huge(0_8)-1_8))
+  call gee_i(i**0_8) ! { dg-warning "Type mismatch in argument" }
+  call gee_i(i**1_8) ! { dg-warning "Type mismatch in argument" }
+  call gee_i(i**2_8) ! { dg-warning "Type mismatch in argument" }
+  call gee_i(i**3_8) ! { dg-warning "Type mismatch in argument" }
+  call gee_i(i**(-1_8)) ! { dg-warning "Type mismatch in argument" }
+  call gee_i(i**(-2_8)) ! { dg-warning "Type mismatch in argument" }
+  call gee_i(i**(-3_8)) ! { dg-warning "Type mismatch in argument" }
+  call gee_i(i**huge(0_8)) ! { dg-warning "Type mismatch in argument" }
+  call gee_i(i**(-huge(0_8))) ! { dg-warning "Type mismatch in argument" }
+  call gee_i(i**(-huge(0_8)-1_8)) ! { dg-warning "Type mismatch in argument" }
 
   ! Real
   call gee_r(a**0_1)
Index: gcc/testsuite/gfortran.dg/g77/19990218-0.f
===================================================================
--- gcc/testsuite/gfortran.dg/g77/19990218-0.f	(revision 162456)
+++ gcc/testsuite/gfortran.dg/g77/19990218-0.f	(working copy)
@@ -2,7 +2,7 @@  c { dg-do compile }
         program test
         double precision a,b,c
         data a,b/1.0d-46,1.0d0/
-        c=fun(a,b)
+        c=fun(a,b) ! { dg-error "Return type mismatch of function" }
         print*,'in main: fun=',c
         end
         double precision function fun(a,b)
Index: gcc/testsuite/gfortran.dg/g77/19990218-1.f
===================================================================
--- gcc/testsuite/gfortran.dg/g77/19990218-1.f	(revision 162456)
+++ gcc/testsuite/gfortran.dg/g77/19990218-1.f	(working copy)
@@ -20,6 +20,6 @@  c
         program test
         double precision a,b,c
         data a,b/1.0d-46,1.0d0/
-        c=fun(a,b)
+        c=fun(a,b) ! { dg-error "Return type mismatch of function" }
         print*,'in main: fun=',c
         end
Index: gcc/testsuite/gfortran.dg/g77/970625-2.f
===================================================================
--- gcc/testsuite/gfortran.dg/g77/970625-2.f	(revision 162456)
+++ gcc/testsuite/gfortran.dg/g77/970625-2.f	(working copy)
@@ -40,7 +40,7 @@ 
          PROGRAM = THEN - IF
          ELSE IF = THEN .GT. IF
          IF (THEN.GT.REAL) THEN
-            CALL FUNCTION PROGRAM (ELSE IF, GO TO PROGRAM, THEN)
+            CALL FUNCTION PROGRAM (ELSE IF, GO TO PROGRAM, THEN) ! { dg-warning "Type mismatch in argument" }
          ELSE IF (ELSE IF) THEN
             REAL = THEN + END DO
          END IF
Index: gcc/testsuite/gfortran.dg/pr37243.f
===================================================================
--- gcc/testsuite/gfortran.dg/pr37243.f	(revision 162456)
+++ gcc/testsuite/gfortran.dg/pr37243.f	(working copy)
@@ -20,8 +20,8 @@ 
       IF (I .EQ. M) GO TO 160
       I1 = I+1
       DO 140 J = I1,M
-      DUM = -DDOT(N,V(1,J),1,V(1,I),1)
-      CALL DAXPY(N,DUM,V(1,I),1,V(1,J),1)
+      DUM = -DDOT(N,V(1,J),1,V(1,I),1) ! { dg-warning "More actual than formal arguments" }
+      CALL DAXPY(N,DUM,V(1,I),1,V(1,J),1) ! { dg-warning "More actual than formal arguments" }
   140 CONTINUE
   160 CONTINUE
       IF (M .EQ. N) RETURN
@@ -35,7 +35,7 @@ 
       IF (J .GT. N) GO TO 320
       DO 240 K = 1,N
   240 V(K,I) = ZERO
-      CALL DAXPY(N,DUM,V(1,I),1,V(1,I),1)
+      CALL DAXPY(N,DUM,V(1,I),1,V(1,I),1) ! { dg-warning "More actual than formal arguments" }
   260 CONTINUE
       DUMI = ZERO
       DO 280 K = 1,N
Index: gcc/testsuite/gfortran.dg/use_only_1.f90
===================================================================
--- gcc/testsuite/gfortran.dg/use_only_1.f90	(revision 162456)
+++ gcc/testsuite/gfortran.dg/use_only_1.f90	(working copy)
@@ -73,6 +73,7 @@  contains
     USE xmod, ONLY: xfoobar_renamed => xfoobar
     USE ymod, ONLY: yfoobar_renamed => yfoobar
     USE ymod
+    implicit integer(4) (a-z)
     if (xfoobar_renamed (42) == xfoobar ()) call abort ()
     if (yfoobar_renamed (42) == yfoobar ()) call abort ()
   end subroutine
Index: gcc/testsuite/gfortran.dg/loc_1.f90
===================================================================
--- gcc/testsuite/gfortran.dg/loc_1.f90	(revision 162456)
+++ gcc/testsuite/gfortran.dg/loc_1.f90	(working copy)
@@ -17,9 +17,10 @@  subroutine fn
 end subroutine fn
 
 subroutine foo (ii)
+  use iso_c_binding, only: c_intptr_t
   common /targ/targ
   integer targ(10)
-  integer ii
+  integer(c_intptr_t) ii
   targ(2) = ii
 end subroutine foo
 
Index: libgomp/testsuite/libgomp.fortran/appendix-a/a.28.5.f90
===================================================================
--- libgomp/testsuite/libgomp.fortran/appendix-a/a.28.5.f90	(revision 162456)
+++ libgomp/testsuite/libgomp.fortran/appendix-a/a.28.5.f90	(working copy)
@@ -1,4 +1,9 @@ 
 ! { dg-do compile }
+! { dg-options "-w" }
+!
+! "-w" added as libgomp/testsuite seemingly cannot parse with
+! dg-warning Fortran's output. Fortran warns for "call sub1(a)"
+! that there is a "Rank mismatch in argument 'x'".
 
       SUBROUTINE SUB1(X)
         DIMENSION X(10)