public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PR fortran/87919 patch for -fno-dec-structure
@ 2018-11-07 15:07 Mark Eggleston
  2018-11-07 15:22 ` Jakub Jelinek
  0 siblings, 1 reply; 15+ messages in thread
From: Mark Eggleston @ 2018-11-07 15:07 UTC (permalink / raw)
  To: fortran, gcc-patches; +Cc: Beth White, Emmet Hikory, Jakub Jelinek, Jeff Law

[-- Attachment #1: Type: text/plain, Size: 1071 bytes --]

Please find attached the patch and a ChangeLog entry. This is my first 
patch, apologies for any mistakes in the submission process.

This patch is the simple removal of an OPT_dec_structure case from a 
switch statement, it was noticeable as there was no corresponding code 
for the other dec specific options. I spotted this before the creation 
of PR fortran/87919 so I now know that this fixes the broken behaviour 
of -fno-dec-structure.

The patch contains a change to gcc/fortran/options.c and four testcases 
pr87919-dec-structure-*.f where * is one of 1, 2, 3 and 4.

The testcases are specified to compile with no specific options, -fdec, 
-fdec-structure and both -fdec and -fno-dec-structure.

After building the compiler on x86_64 I got the following results 
aggregated from make -j 5 check-fortran:

         === gfortran Summary ===

# of expected passes        48184
# of expected failures        103
# of unsupported tests        79


-- 
https://www.codethink.co.uk/privacy.html


[-- Attachment #2: ChangeLogEntry.txt --]
[-- Type: text/plain, Size: 135 bytes --]

	PR fortran/87919
	* options.c (gfc_handle_option): Removed case OPT_fdec_structure
	as it breaks the handling of -fno-dec-structure.


[-- Attachment #3: pr87919-dec-structure.patch --]
[-- Type: text/x-patch, Size: 3907 bytes --]

diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index 73f5389361d9..3b7c2d40fe8a 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -761,10 +761,6 @@ gfc_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
       /* Enable all DEC extensions.  */
       set_dec_flags (1);
       break;
-
-    case OPT_fdec_structure:
-      flag_dec_structure = 1;
-      break;
     }
 
   Fortran_handle_option_auto (&global_options, &global_options_set, 
diff --git a/gcc/testsuite/gfortran.dg/pr87919-dec-structure-1.f b/gcc/testsuite/gfortran.dg/pr87919-dec-structure-1.f
new file mode 100644
index 000000000000..4dd34082b97a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr87919-dec-structure-1.f
@@ -0,0 +1,21 @@
+! { dg-do compile }
+!
+! PR/fortran/87919
+!
+! Should fail to compile without the -fdec or -fdec-structure options
+!
+! Contributed by Mark Eggleston <mark.eggleston@codethink.com>
+
+      program test
+
+        structure /info/ ! { dg-error "-fdec-structure" }
+          integer a
+          real b
+         end structure   ! { dg-error "END PROGRAM" }
+
+        record /info/ s  ! { dg-error "-fdec-structure" }
+        s.a = 199        ! { dg-error "Unclassifiable" }
+        s.b = 7.6        ! { dg-error "Unclassifiable" }
+        write (*,*) s.a  ! { dg-error "Syntax error in WRITE" }
+        write (*,*) s.b  ! { dg-error "Syntax error in WRITE" }
+      end program test
diff --git a/gcc/testsuite/gfortran.dg/pr87919-dec-structure-2.f b/gcc/testsuite/gfortran.dg/pr87919-dec-structure-2.f
new file mode 100644
index 000000000000..e2ebfe344abb
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr87919-dec-structure-2.f
@@ -0,0 +1,22 @@
+! { dg-do run }
+! { dg-options "-fdec" }
+!
+! PR/fortran/87919
+!
+! Should compile anf run with the -fdec option
+!
+! Contributed by Mark Eggleston <mark.eggleston@codethink.com>
+!
+     program test
+
+        structure /info/
+          integer a
+          real b
+         end structure
+
+        record /info/ s
+        s.a = 199
+        s.b = 7.6
+        if (s.a .ne. 199) stop 1
+        if (abs(s.b - 7.6) .gt. 1e-5) stop 2
+      end program test
diff --git a/gcc/testsuite/gfortran.dg/pr87919-dec-structure-3.f b/gcc/testsuite/gfortran.dg/pr87919-dec-structure-3.f
new file mode 100644
index 000000000000..e543b37a4371
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr87919-dec-structure-3.f
@@ -0,0 +1,22 @@
+! { dg-do run }
+! { dg-options "-fdec-structure" }
+!
+! PR/fortran/87919
+!
+! Should compile anf run with the -fdec option
+!
+! Contributed by Mark Eggleston <mark.eggleston@codethink.com>
+!
+      program test
+
+        structure /info/
+          integer a
+          real b
+         end structure
+
+        record /info/ s
+        s.a = 199
+        s.b = 7.6
+        if (s.a .ne. 199) stop 1
+        if (abs(s.b - 7.6) .gt. 1e-5) stop 2
+      end program test
diff --git a/gcc/testsuite/gfortran.dg/pr87919-dec-structure-4.f b/gcc/testsuite/gfortran.dg/pr87919-dec-structure-4.f
new file mode 100644
index 000000000000..fa5f1d7a3436
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr87919-dec-structure-4.f
@@ -0,0 +1,22 @@
+! { dg-do compile }
+! { dg-options "-fdec -fno-dec-structure" }
+!
+! PR/fortran/87919
+!
+! Should fail to compile with the -fdec and -fno-dec-structure option
+!
+! Contributed by Mark Eggleston <mark.eggleston@codethink.com>
+!
+      program test
+
+        structure /info/ ! { dg-error "-fdec-structure" }
+          integer a
+          real b
+         end structure   ! { dg-error "END PROGRAM" }
+
+        record /info/ s  ! { dg-error "-fdec-structure" }
+        s.a = 199        ! { dg-error "Unclassifiable" }
+        s.b = 7.6        ! { dg-error "Unclassifiable" }
+        write (*,*) s.a  ! { dg-error "Syntax error in WRITE" }
+        write (*,*) s.b  ! { dg-error "Syntax error in WRITE" }
+      end program test

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2018-12-03 17:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-07 15:07 PR fortran/87919 patch for -fno-dec-structure Mark Eggleston
2018-11-07 15:22 ` Jakub Jelinek
2018-11-07 22:05   ` Fritz Reese
2018-11-07 22:32     ` Jakub Jelinek
2018-11-08 17:09       ` Fritz Reese
2018-11-08 17:54         ` Jakub Jelinek
2018-11-12 20:29           ` Fritz Reese
2018-11-12 20:42             ` Jakub Jelinek
2018-11-12 20:53               ` Fritz Reese
2018-11-22 11:46                 ` Jakub Jelinek
2018-12-03 15:26             ` Mark Eggleston
2018-12-03 15:52               ` Fritz Reese
2018-12-03 15:58                 ` Jakub Jelinek
2018-12-03 17:12                   ` Jakub Jelinek
2018-12-03 17:39                     ` Fritz Reese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).