]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
options.c (gfc_init_options_struct): assert that the frontend sets flag_errno_math...
authorJoost VandeVondele <Joost.VandeVondele@mat.ethz.ch>
Wed, 20 Aug 2014 07:08:57 +0000 (09:08 +0200)
committerJoost VandeVondele <vondele@gcc.gnu.org>
Wed, 20 Aug 2014 07:08:57 +0000 (07:08 +0000)
gcc/fortran/ChangeLog:

2014-08-20  Joost VandeVondele  <Joost.VandeVondele@mat.ethz.ch>

* options.c (gfc_init_options_struct): assert that the frontend sets
        flag_errno_math and flag_associative_math.

gcc/testsuite/ChangeLog:

2014-08-20  Joost VandeVondele  <Joost.VandeVondele@mat.ethz.ch>

* gfortran.dg/errnocheck_1.f90: New test.
* gfortran.dg/associative_1.f90: New test.

From-SVN: r214211

gcc/fortran/ChangeLog
gcc/fortran/options.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/associative_1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/errnocheck_1.f90 [new file with mode: 0644]

index 53d2691c6bb22da1e30d49eb7306d9b4c4e0640f..9d939ea35c3d98ea28bcaecdf02bade5c7e5f293 100644 (file)
@@ -1,3 +1,8 @@
+2014-08-20  Joost VandeVondele  <Joost.VandeVondele@mat.ethz.ch>
+
+       * options.c (gfc_init_options_struct): assert that the frontend sets
+       flag_errno_math and flag_associative_math.
+
 2014-08-17  Tobias Burnus  <burnus@net-b.de>
 
        * resolve.c (gfc_resolve_finalizers): Ensure that parents are
index 508a01c57f87ba74645a25b16bfd793adf2305d7..2f4338e175e22ddb9a499e0b999c2c79b88ae2a1 100644 (file)
@@ -66,7 +66,9 @@ void
 gfc_init_options_struct (struct gcc_options *opts)
 {
   opts->x_flag_errno_math = 0;
+  opts->frontend_set_flag_errno_math = true;
   opts->x_flag_associative_math = -1;
+  opts->frontend_set_flag_associative_math = true;
 }
 
 /* Get ready for options handling. Keep in sync with
index dc10ea9b2ff321b5e0f00066f5a253e269b92862..b8473c3a62293eee3a590ed449a06aee4788754b 100644 (file)
@@ -1,3 +1,8 @@
+2014-08-20  Joost VandeVondele  <Joost.VandeVondele@mat.ethz.ch>
+
+       * gfortran.dg/errnocheck_1.f90: New test.
+       * gfortran.dg/associative_1.f90: New test.
+
 2014-08-20  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        PR preprocessor/51303
diff --git a/gcc/testsuite/gfortran.dg/associative_1.f90 b/gcc/testsuite/gfortran.dg/associative_1.f90
new file mode 100644 (file)
index 0000000..c4103a7
--- /dev/null
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! { dg-options "-O1 -fno-signed-zeros -fno-trapping-math -fdump-tree-optimized" }
+! Fortran defaults to associative by default,
+! with -fno-signed-zeros -fno-trapping-math this should optimize away all additions
+SUBROUTINE S1(a)
+ REAL :: a
+ a=1+a-1
+END SUBROUTINE S1
+! { dg-final { scan-tree-dump-times " \\\+ " 0 "optimized" } }
+! { dg-final { cleanup-tree-dump "optimized" } }
diff --git a/gcc/testsuite/gfortran.dg/errnocheck_1.f90 b/gcc/testsuite/gfortran.dg/errnocheck_1.f90
new file mode 100644 (file)
index 0000000..d9cf994
--- /dev/null
@@ -0,0 +1,8 @@
+! { dg-do compile { target x86_64-*-* } }
+! Fortran should default to -fno-math-errno
+! and thus no call to sqrt in asm
+subroutine mysqrt(a)
+ real(KIND=KIND(0.0D0)) :: a
+ a=sqrt(a)
+end subroutine
+! { dg-final { scan-assembler-times "call" 0 } }