public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jim Wilson <wilson@cygnus.com>
To: egcs@cygnus.com
Subject: Re: f771 dies with trivial fortran code
Date: Wed, 20 Aug 1997 19:30:07 -0000	[thread overview]
Message-ID: <199708201930.MAA23421@cygnus.com> (raw)
In-Reply-To: f771 dies with trivial fortran code

This is due to a backend change made since gcc 2.7.2.

Some code was added to handle C++ destructors inside conditional expressions
differently than they used to be handled.  This apparently was necessary
for correct behaviour, though I don't know exactly what bug was being fixed.
(Perhaps destructors were always run, even if the variable was only constructed
on one side of the conditional expression?)

Anyways, this causes problems if a conditional expression appears inside
the type expression of a parameter.  The code expects us to always have
a binding contour, but we do not have one when parsing the parameters.
Since no destructors are possible in this case, it is safe for us to
do nothing.

A C testcase:

sub (int a, int b, int c[a > b ? a : b])
{
}

A Fortran testcase:

	subroutine foo ()
	character*(*) str
c
	return
c
	entry bar (str)
	str = 'a'
c	^^^^^^^^ culprit
	return
	end
c

I have checked in this patch to fix the problem.

Wed Aug 20 11:58:33 1997  Jim Wilson  <wilson@cygnus.com>

	* stmt.c (start_cleanup_deferal, end_cleanup_deferal): Test
	block_stack before dereferencing it.

Index: stmt.c
===================================================================
RCS file: /cvs/cvsfiles/egcs/stmt.c,v
retrieving revision 1.1.1.1
diff -p -r1.1.1.1 stmt.c
*** stmt.c	1997/08/11 15:57:13	1.1.1.1
--- stmt.c	1997/08/20 18:43:30
*************** expand_cleanups (list, dont_do, in_fixup
*** 4212,4218 ****
  void
  start_cleanup_deferal ()
  {
!   ++block_stack->data.block.conditional_code;
  }
  
  /* Mark the end of a conditional region of code.  Because cleanup
--- 4212,4221 ----
  void
  start_cleanup_deferal ()
  {
!   /* block_stack can be NULL if we are inside the parameter list.  It is
!      OK to do nothing, because cleanups aren't possible here.  */
!   if (block_stack)
!     ++block_stack->data.block.conditional_code;
  }
  
  /* Mark the end of a conditional region of code.  Because cleanup
*************** start_cleanup_deferal ()
*** 4223,4229 ****
  void
  end_cleanup_deferal ()
  {
!   --block_stack->data.block.conditional_code;
  }
  
  /* Move all cleanups from the current block_stack
--- 4226,4235 ----
  void
  end_cleanup_deferal ()
  {
!   /* block_stack can be NULL if we are inside the parameter list.  It is
!      OK to do nothing, because cleanups aren't possible here.  */
!   if (block_stack)
!     --block_stack->data.block.conditional_code;
  }
  
  /* Move all cleanups from the current block_stack

             reply	other threads:[~1997-08-20 19:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-08-20 19:30 Jim Wilson [this message]
  -- strict thread matches above, loose matches on Subject: below --
1997-08-20 23:11 Mumit Khan
1997-08-20 16:37 Trouble with GAS halfword extraction on PPC Peter Barada
1997-08-20 16:37 ` f771 dies with trivial fortran code Jeffrey A Law
1997-08-20 15:03 cross compiling to m68k Joel Sherrill
1997-08-20 15:03 ` f771 dies with trivial fortran code Mumit Khan
1997-08-20  5:23 Mumit Khan
1997-08-20  5:23 objc SMP patch Oleg Krivosheev
1997-08-20  5:23 ` f771 dies with trivial fortran code Craig Burley

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=199708201930.MAA23421@cygnus.com \
    --to=wilson@cygnus.com \
    --cc=egcs@cygnus.com \
    /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).