public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Mark Mitchell <mark@codesourcery.com>
To: mmitchel@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: c++/4884: g++ 3.0.2 problem with -fvolatile
Date: Wed, 27 Mar 2002 11:26:00 -0000	[thread overview]
Message-ID: <20020327192601.9298.qmail@sources.redhat.com> (raw)

The following reply was made to PR c++/4884; it has been noted by GNATS.

From: Mark Mitchell <mark@codesourcery.com>
To: "Ashif S. Harji" <asharji@plg2.math.uwaterloo.ca>,
   "mmitchel@gcc.gnu.org" <mmitchel@gcc.gnu.org>,
   "asharji@uwaterloo.ca" <asharji@uwaterloo.ca>,
   "gcc-bugs@gcc.gnu.org" <gcc-bugs@gcc.gnu.org>,
   "gcc-prs@gcc.gnu.org" <gcc-prs@gcc.gnu.org>,
   "pabuhr@uwaterloo.ca" <pabuhr@uwaterloo.ca>,
   "gcc-gnats@gcc.gnu.org" <gcc-gnats@gcc.gnu.org>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: c++/4884: g++ 3.0.2 problem with -fvolatile
Date: Wed, 27 Mar 2002 11:14:35 -0800

 --On Tuesday, March 26, 2002 06:21:10 PM -0500 "Ashif S. Harji" 
 <asharji@plg2.math.uwaterloo.ca> wrote:
 
 >
 > Thanks, for the prompt response.
 >
 > I downloaded the latest version from CVS.  Unfortunately, there is still a
 > problem in the build_op_delete_call function.
 >
 > The compilation of the following program fails with a segault when
 > -fvolatile is used but not without.  Note the addition of the constructor
 > to class bar.
 >
 > 2>@awk[114]% more test3.cc
 >
 > class bar {
 >   public :
 >     bar() { }
 >     void * operator new ( unsigned int , void * storage ) { return (void
 > *)1;} };
 >
 > class foo {
 >   public:
 >     void mem ( ) {
 >         new ( 0 ) bar;
 >     }
 > };
 >
 
 Well, that one wasn't in your original bug report. :-)
 
 Fixed with the attached patch.  Tested on i686-pc-linux-gnu, applied
 on the mainline and on the branch.
 
 --
 Mark Mitchell                   mark@codesourcery.com
 CodeSourcery, LLC               http://www.codesourcery.com
 
 2002-03-27  Mark Mitchell  <mark@codesourcery.com>
 
 	PR c++/4884
 	* call.c (build_op_delete_call): Allow for the fact the placement
 	may be a COMPOUND_EXPR.
 	
 Index: cp/call.c
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/cp/call.c,v
 retrieving revision 1.307.2.4
 diff -c -p -r1.307.2.4 call.c
 *** call.c	2002/03/18 16:44:07	1.307.2.4
 --- call.c	2002/03/27 18:38:06
 *************** build_op_delete_call (code, addr, size,
 *** 3623,3637 ****
 
     if (placement)
       {
 !       /* placement is a CALL_EXPR around an ADDR_EXPR around a function. 
 */
 
         /* Extract the function.  */
 !       argtypes = TREE_OPERAND (TREE_OPERAND (placement, 0), 0);
         /* Then the second parm type.  */
 !       argtypes = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (argtypes)));
 !
         /* Also the second argument.  */
 !       args = TREE_CHAIN (TREE_OPERAND (placement, 1));
       }
     else
       {
 --- 3623,3644 ----
 
     if (placement)
       {
 !       tree alloc_fn;
 !       tree call_expr;
 
 +       /* Find the allocation function that is being called. */
 +       call_expr = placement;
 +       /* Sometimes we have a COMPOUND_EXPR, rather than a simple
 + 	 CALL_EXPR. */
 +       while (TREE_CODE (call_expr) == COMPOUND_EXPR)
 + 	call_expr = TREE_OPERAND (call_expr, 1);
         /* Extract the function.  */
 !       alloc_fn = get_callee_fndecl (call_expr);
 !       my_friendly_assert (alloc_fn != NULL_TREE, 20020327);
         /* Then the second parm type.  */
 !       argtypes = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (alloc_fn)));
         /* Also the second argument.  */
 !       args = TREE_CHAIN (TREE_OPERAND (call_expr, 1));
       }
     else
       {
 Index: testsuite/g++.dg/init/new2.C
 ===================================================================
 RCS file: new2.C
 diff -N new2.C
 *** /dev/null	Tue May  5 13:32:27 1998
 --- new2.C	Wed Mar 27 10:38:08 2002
 ***************
 *** 0 ****
 --- 1,18 ----
 + // Origin: asharji@uwaterloo.ca
 +
 + // { dg-do compile }
 + // { dg-options "-fvolatile" }
 +
 + class bar {
 +   public :
 +     bar() { }
 +     void * operator new ( __SIZE_TYPE__ , void * storage )
 +      { return (void *)1;}
 + };
 +
 + class foo {
 +   public:
 +     void mem ( ) {
 +         new ( 0 ) bar;
 +     }
 + };
 


             reply	other threads:[~2002-03-27 19:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-27 11:26 Mark Mitchell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-03-26 15:26 Ashif S. Harji
2002-03-26 10:38 mmitchel
2002-03-25 10:53 mmitchel
2001-11-16  9:09 lerdsuwa
2001-11-08 11:36 lerdsuwa
2001-11-08 11:13 lerdsuwa
2001-11-04  2:47 asharji

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=20020327192601.9298.qmail@sources.redhat.com \
    --to=mark@codesourcery.com \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=mmitchel@gcc.gnu.org \
    /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).