public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PR 60414: Patch proposal
@ 2014-07-18 10:03 Andre Vehreschild
  0 siblings, 0 replies; 5+ messages in thread
From: Andre Vehreschild @ 2014-07-18 10:03 UTC (permalink / raw)
  To: gcc-patches, fortran

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

Hi all,

this is my first try to submit a patch, so please be kind and correct me when I
do something wrong.

I was contracted to fix some issues listed in the bugtracker for fortran.
Please find attached my first attempt for bug PR60414 (I'll attach it to the
bug in the tracker in a second).

The bug terminates the compiler, because in the translation phase an unexpected
construction is seen as actual argument. I tracked down the location where the
decision to construct the parse tree seen is made and deduced, that the
parameter matching is not respecting the array_ref done in the code not
compiling. I have fixed this by checking if the ->ref member of the actual
argument is set. The analysis continues and the test case created for it
compile fine now.

Patch content:
- Changelog entry in gcc/fortran/Changelog
- Changelog entry in gcc/testsuite/Changelog
- Patch in interface.c: two line comment, one line actual code
- Testcase in gcc/testsuite/fortran.dg/unlimited_polymorphism_18.f90

Regards,
	Andre
-- 
Andre Vehreschild

[-- Attachment #2: pr60414.patch --]
[-- Type: text/x-patch, Size: 1635 bytes --]

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index c33936b..cb01a13 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,11 @@
+2014-07-19  Andre Vehreschild <vehre@gmx.de>
+
+	PR fortran/60414
+	* interface.c (compare_parameter): Fix compile bug: During resolution
+	of generic an array reference in the actual argument was not
+	respected. Fixed by checking, if the ref member is non-null. Testcase
+	unlimited_polymorphism_18.f90 add.
+
 2014-06-15  Tobias Burnus  <burnus@net-b.de>
 
 	* symbol.c (check_conflict): Add codimension conflict with
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index b210d18..8658003 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -2156,7 +2156,10 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
   if (symbol_rank (formal) == actual->rank || symbol_rank (formal) == -1)
     return 1;
 
+  /* Only check ranks compatibility, if actual is not an array reference,
+     i.e., actual(i) indicated by actual->ref being set. */
   if (actual->ts.type == BT_CLASS && CLASS_DATA (actual)->as
+        && !actual->ref
 	&& CLASS_DATA (actual)->as->rank == symbol_rank (formal))
     return 1;
 
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f6e9f23..84e16da 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-07-19  Andre Vehreschild <vehre@gmx.de>
+
+	* gfortran.dg/unlimited_polymorphism_18.f90: Check according to 
+	PR 60414
+
 2014-07-17  Richard Sandiford  <rdsandiford@googlemail.com>
 
 	* gcc.target/mips/umips-lwp-1.c (foo): Use a shift/add sequence

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: PR 60414: Patch proposal
@ 2014-07-19  0:36 FX
  2014-07-19 11:56 ` Andre Vehreschild
  0 siblings, 1 reply; 5+ messages in thread
From: FX @ 2014-07-19  0:36 UTC (permalink / raw)
  To: vehre; +Cc: gcc-patches, Fortran List

Hi Andre, and welcome aboard!

The explanation you give is nice, your patch submission looks clean. Two things:

  1. Do you have a copyright assignment on file with the FSF? See https://gcc.gnu.org/contribute.html

  2. Normally, all GCC patch submissions should be accompanied by a statement saying how you tested the patch. The standard thing to do is to check that the patched sources still bootstrap and that there is no regression in the testsuite. This can be stated as “Patch bootstrapped and regtested on <insert here your testing platform triplet, like x86_64-apple-darwin13>”. In that particular case, it might also be nice to indicate that not only the testcase doesn’t crash the compiler any more, but to confirm that it now generates the correct code (i.e. that we don’t turn an ice-on-valid bug into a wrong-code bug!).

Cheers,
FX

^ permalink raw reply	[flat|nested] 5+ messages in thread
[parent not found: <20140721072605.0D680105@mailhost.lps.ens.fr>]

end of thread, other threads:[~2014-07-26 19:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-18 10:03 PR 60414: Patch proposal Andre Vehreschild
2014-07-19  0:36 FX
2014-07-19 11:56 ` Andre Vehreschild
     [not found] <20140721072605.0D680105@mailhost.lps.ens.fr>
     [not found] ` <20140721150350.10b35dd3@vepi2.private>
2014-07-21 15:47   ` Dominique d'Humières
2014-07-26 20:14     ` Mikael Morin

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).