From: <jimmie.davis@l-3com.com>
To: <mikael.morin@sfr.fr>, <gcc-patches@gcc.gnu.org>, <fortran@gcc.gnu.org>
Subject: RE: patch fortran, pr 59746, internal compiler error : segmentation fault
Date: Mon, 10 Mar 2014 07:49:00 -0000 [thread overview]
Message-ID: <FFF95760268D324AB6DD9426E83C8DF70B2E1227@ARLEXCHMBX01.lst.link.l-3com.com> (raw)
In-Reply-To: <531CD1A3.6070303@sfr.fr>
________________________________________
From: Mikael Morin [mikael.morin@sfr.fr]
Sent: Sunday, March 09, 2014 3:40 PM
To: Davis, Bud @ SSG - Link; gcc-patches@gcc.gnu.org; fortran@gcc.gnu.org
Subject: Re: patch fortran, pr 59746, internal compiler error : segmentation fault
> - if (p->gfc_new)
>write this instead:
>if (p->attr.in_common && p->common_block && p->common_block->head
> && (p->gfc_new || !p->old_symbol->attr.in_common))
>[p->attr.in_common is less likely than p->gfc_new which happens all the
>time; we may as well short-circuit the latter.]
Done.
>For the rest of the patch, there are indentation issues, any leading 8
>spaces block should be replaced with a tab.
Done. All sequences of 8 spaces are replaced with a tab.
>You can use "contrib/check_GNU_style.sh your_patch" to check common
>style issues)
All issues fixed, except for test case lines, the 'dg error' lines are over 80 columns. A lot of the tests do this, I am guessing this violation is acceptable.
> + if (p->common_block->head == p)
>I think the code block starting here is indented too much.
Fixed.
> + if (p->gfc_new)
>Same here, the code after this shouldn't need reindenting.
Fixed.
>Mikael
Below is the revised patch. Still passes the testsuite with no new failures.
regards,
Bud Davis
Index: gcc/gcc/testsuite/gfortran.dg/pr59746.f90
===================================================================
--- gcc/gcc/testsuite/gfortran.dg/pr59746.f90 (revision 0)
+++ gcc/gcc/testsuite/gfortran.dg/pr59746.f90 (revision 0)
@@ -0,0 +1,18 @@
+! { dg-do compile }
+!pr59746
+ CALL RCCFL (NVE,IR,NU3,VE (1,1,1,I))
+ COMMON /CCFILE/ INTG,NT1,NT2,NT3,NVM,NVE,NFRLE,NRESF,NRESL !{ dg-error "Unexpected COMMON" }
+ COMMON /CCFILE/ INTG,NT1,NT2,NT3,NVM,NVE,NFRLE,NRESF,NRESL !{ dg-error "Unexpected COMMON" }
+! the PR only contained the two above.
+! success is no segfaults or infinite loops.
+! let's check some combinations
+ CALL ABC (INTG)
+ COMMON /CCFILE/ INTG,NT1,NT2,NT3,NVM,NVE,NFRLE,NRESF,NRESL !{ dg-error "Unexpected COMMON" }
+ COMMON /CCFILE/ INTG,NT1,NT2,NT3,NVM,NVE,NFRLE,NRESF,NRESL !{ dg-error "Unexpected COMMON" }
+ CALL DEF (NT1)
+ COMMON /CCFILE/ INTG,NT1,NT2,NT3,NVM,NVE,NFRLE,NRESF,NRESL !{ dg-error "Unexpected COMMON" }
+ COMMON /CCFILE/ INTG,NT1,NT2,NT3,NVM,NVE,NFRLE,NRESF,NRESL !{ dg-error "Unexpected COMMON" }
+ CALL GHI (NRESL)
+ COMMON /CCFILE/ INTG,NT1,NT2,NT3,NVM,NVE,NFRLE,NRESF,NRESL !{ dg-error "Unexpected COMMON" }
+ COMMON /CCFILE/ INTG,NT1,NT2,NT3,NVM,NVE,NFRLE,NRESF,NRESL !{ dg-error "Unexpected COMMON" }
+ END
Index: gcc/gcc/fortran/symbol.c
===================================================================
--- gcc/gcc/fortran/symbol.c (revision 208437)
+++ gcc/gcc/fortran/symbol.c (working copy)
@@ -3069,56 +3069,56 @@
FOR_EACH_VEC_ELT (latest_undo_chgset->syms, i, p)
{
- if (p->gfc_new)
+ /* Symbol was new. Or was old and just put in common. */
+ if ( p->attr.in_common && p->common_block && p->common_block->head
+ && (p->gfc_new || !p->old_symbol->attr.in_common))
{
- /* Symbol was new. */
- if (p->attr.in_common && p->common_block && p->common_block->head)
- {
- /* If the symbol was added to any common block, it
- needs to be removed to stop the resolver looking
- for a (possibly) dead symbol. */
+ /* If the symbol was added to any common block, it
+ needs to be removed to stop the resolver looking
+ for a (possibly) dead symbol. */
- if (p->common_block->head == p && !p->common_next)
+ if (p->common_block->head == p && !p->common_next)
+ {
+ gfc_symtree st, *st0;
+ st0 = find_common_symtree (p->ns->common_root,
+ p->common_block);
+ if (st0)
{
- gfc_symtree st, *st0;
- st0 = find_common_symtree (p->ns->common_root,
- p->common_block);
- if (st0)
- {
- st.name = st0->name;
- gfc_delete_bbt (&p->ns->common_root, &st, compare_symtree);
- free (st0);
- }
+ st.name = st0->name;
+ gfc_delete_bbt (&p->ns->common_root, &st, compare_symtree);
+ free (st0);
}
+ }
- if (p->common_block->head == p)
- p->common_block->head = p->common_next;
- else
- {
- gfc_symbol *cparent, *csym;
+ if (p->common_block->head == p)
+ p->common_block->head = p->common_next;
+ else
+ {
+ gfc_symbol *cparent, *csym;
- cparent = p->common_block->head;
- csym = cparent->common_next;
+ cparent = p->common_block->head;
+ csym = cparent->common_next;
- while (csym != p)
- {
- cparent = csym;
- csym = csym->common_next;
- }
-
- gcc_assert(cparent->common_next == p);
-
- cparent->common_next = csym->common_next;
+ while (csym != p)
+ {
+ cparent = csym;
+ csym = csym->common_next;
}
- }
+ gcc_assert (cparent->common_next == p);
+ cparent->common_next = csym->common_next;
+ }
+ }
+ if (p->gfc_new)
+ {
/* The derived type is saved in the symtree with the first
letter capitalized; the all lower-case version to the
derived type contains its associated generic function. */
+
if (p->attr.flavor == FL_DERIVED)
gfc_delete_symtree (&p->ns->sym_root, gfc_get_string ("%c%s",
- (char) TOUPPER ((unsigned char) p->name[0]),
- &p->name[1]));
+ (char) TOUPPER ((unsigned char) p->name[0]),
+ &p->name[1]));
else
gfc_delete_symtree (&p->ns->sym_root, p->name);
@@ -3127,7 +3127,6 @@
else
restore_old_symbol (p);
}
-
latest_undo_chgset->syms.truncate (0);
latest_undo_chgset->tbps.truncate (0);
next prev parent reply other threads:[~2014-03-10 2:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-09 13:57 jimmie.davis
2014-03-09 17:31 ` Mikael Morin
2014-03-09 20:35 ` jimmie.davis
2014-03-09 21:38 ` Mikael Morin
2014-03-10 7:49 ` jimmie.davis [this message]
2014-03-13 21:24 ` Mikael Morin
2014-04-27 18:56 ` Tobias Burnus
2015-07-29 19:18 ` Mikael Morin
2015-08-06 10:11 ` *ping* " Mikael Morin
2015-08-06 10:28 ` Paul Richard Thomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=FFF95760268D324AB6DD9426E83C8DF70B2E1227@ARLEXCHMBX01.lst.link.l-3com.com \
--to=jimmie.davis@l-3com.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=mikael.morin@sfr.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).