public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/4884: g++ 3.0.2 problem with -fvolatile
@ 2001-11-04 2:47 asharji
0 siblings, 0 replies; 8+ messages in thread
From: asharji @ 2001-11-04 2:47 UTC (permalink / raw)
To: gcc-gnats; +Cc: pabuhr
>Number: 4884
>Category: c++
>Synopsis: g++ 3.0.2 problem with -fvolatile
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Thu Nov 15 12:26:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Ashif Harji
>Release: gcc version 3.0.2
>Organization:
>Environment:
operating system version: Redhat 7.1
hardware architecture: athalon 1.4 ghz
>Description:
I am having a problem with g++ 3.0.2 using -fvolatile.
1>@awk[114]% g++ -v
Reading specs from /u/asharji/gcc/gcc302/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.0.2/specs
Configured with: /u/asharji/gcc/gcc-3.0.2/configure --prefix=/u/asharji/gcc/gcc302/
Thread model: single
gcc version 3.0.2
When I compile without -fvolatile, it works:
1>@awk[117]% g++ test1.cc -c
But not when I compile with -fvolatile:
1>@awk[118]% g++ test1.cc -c -fvolatile
test1.cc: In member function `void foo::mem()':
test1.cc:14: Internal error #20000521.
test1.cc:14: Internal compiler error in build_new_1, at cp/init.c:2426
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
This error does not occur with gcc-2.95.3:
@tcl[104]% g++ -v
Reading specs from /u/asharji/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/specs
gcc version 2.95.3 20010315 (release)
@tcl[110]% g++ test1.cc -c
@tcl[111]% g++ test1.cc -c -fvolatile
@tcl[112]%
>How-To-Repeat:
1>@awk[113]% cat test1.cc
typedef unsigned int size_t;
class bar {
int i;
public :
void * operator new ( size_t , void * storage );
};
class foo {
int storage[ 5 ];
public:
void mem ( ) {
bar *s = new ( ( void * ) & storage ) bar;
}
};
1>@awk[118]% g++ test1.cc -c -fvolatile
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: c++/4884: g++ 3.0.2 problem with -fvolatile
@ 2002-03-27 11:26 Mark Mitchell
0 siblings, 0 replies; 8+ messages in thread
From: Mark Mitchell @ 2002-03-27 11:26 UTC (permalink / raw)
To: mmitchel; +Cc: gcc-prs
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;
+ }
+ };
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: c++/4884: g++ 3.0.2 problem with -fvolatile
@ 2002-03-26 15:26 Ashif S. Harji
0 siblings, 0 replies; 8+ messages in thread
From: Ashif S. Harji @ 2002-03-26 15:26 UTC (permalink / raw)
To: mmitchel; +Cc: gcc-prs
The following reply was made to PR c++/4884; it has been noted by GNATS.
From: "Ashif S. Harji" <asharji@plg2.math.uwaterloo.ca>
To: mmitchel@gcc.gnu.org, <asharji@uwaterloo.ca>, <gcc-bugs@gcc.gnu.org>,
<gcc-prs@gcc.gnu.org>, <mmitchel@gcc.gnu.org>, <pabuhr@uwaterloo.ca>,
<gcc-gnats@gcc.gnu.org>
Cc:
Subject: Re: c++/4884: g++ 3.0.2 problem with -fvolatile
Date: Tue, 26 Mar 2002 18:21:10 -0500 (EST)
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;
}
};
2>@awk[115]% g++ test3.cc -c
2>@awk[116]% g++ test3.cc -fvolatile -c
test3.cc: In member function `void foo::mem()':
test3.cc:11: internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
2>@awk[117]% g++ -v
Reading specs from ~/gccinstall/lib/gcc-lib/i686-pc-linux-gnu/3.2/specs
Configured with: ../gcc/configure --prefix=~/gccinstall --enable-languages=c,c++ :
Thread model: single
gcc version 3.2 20020326 (experimental)
thanks,
ashif.
On 26 Mar 2002 mmitchel@gcc.gnu.org wrote:
> Synopsis: g++ 3.0.2 problem with -fvolatile
>
> State-Changed-From-To: analyzed->closed
> State-Changed-By: mmitchel
> State-Changed-When: Tue Mar 26 10:38:32 2002
> State-Changed-Why:
> Fixed.
>
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4884
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: c++/4884: g++ 3.0.2 problem with -fvolatile
@ 2002-03-26 10:38 mmitchel
0 siblings, 0 replies; 8+ messages in thread
From: mmitchel @ 2002-03-26 10:38 UTC (permalink / raw)
To: asharji, gcc-bugs, gcc-prs, mmitchel, pabuhr
Synopsis: g++ 3.0.2 problem with -fvolatile
State-Changed-From-To: analyzed->closed
State-Changed-By: mmitchel
State-Changed-When: Tue Mar 26 10:38:32 2002
State-Changed-Why:
Fixed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4884
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: c++/4884: g++ 3.0.2 problem with -fvolatile
@ 2002-03-25 10:53 mmitchel
0 siblings, 0 replies; 8+ messages in thread
From: mmitchel @ 2002-03-25 10:53 UTC (permalink / raw)
To: asharji, gcc-bugs, gcc-prs, mmitchel, nobody, pabuhr
Synopsis: g++ 3.0.2 problem with -fvolatile
Responsible-Changed-From-To: unassigned->mmitchel
Responsible-Changed-By: mmitchel
Responsible-Changed-When: Mon Mar 25 10:53:09 2002
Responsible-Changed-Why:
Working on a fix.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4884
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: c++/4884: g++ 3.0.2 problem with -fvolatile
@ 2001-11-16 9:09 lerdsuwa
0 siblings, 0 replies; 8+ messages in thread
From: lerdsuwa @ 2001-11-16 9:09 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/4884; it has been noted by GNATS.
From: lerdsuwa@gcc.gnu.org
To: asharji@uwaterloo.ca, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org,
gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, pabuhr@uwaterloo.ca
Cc:
Subject: Re: c++/4884: g++ 3.0.2 problem with -fvolatile
Date: 17 Nov 2001 08:14:25 -0000
Synopsis: g++ 3.0.2 problem with -fvolatile
State-Changed-From-To: open->analyzed
State-Changed-By: lerdsuwa
State-Changed-When: Sat Nov 17 00:14:24 2001
State-Changed-Why:
Confirmed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4884&database=gcc
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: c++/4884: g++ 3.0.2 problem with -fvolatile
@ 2001-11-08 11:36 lerdsuwa
0 siblings, 0 replies; 8+ messages in thread
From: lerdsuwa @ 2001-11-08 11:36 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/4884; it has been noted by GNATS.
From: lerdsuwa@gcc.gnu.org
To: asharji@uwaterloo.ca, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org,
gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, pabuhr@uwaterloo.ca
Cc:
Subject: Re: c++/4884: g++ 3.0.2 problem with -fvolatile
Date: 17 Nov 2001 08:14:25 -0000
Synopsis: g++ 3.0.2 problem with -fvolatile
State-Changed-From-To: open->analyzed
State-Changed-By: lerdsuwa
State-Changed-When: Sat Nov 17 00:14:24 2001
State-Changed-Why:
Confirmed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4884&database=gcc
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: c++/4884: g++ 3.0.2 problem with -fvolatile
@ 2001-11-08 11:13 lerdsuwa
0 siblings, 0 replies; 8+ messages in thread
From: lerdsuwa @ 2001-11-08 11:13 UTC (permalink / raw)
To: asharji, gcc-bugs, gcc-gnats, gcc-prs, nobody, pabuhr
Synopsis: g++ 3.0.2 problem with -fvolatile
State-Changed-From-To: open->analyzed
State-Changed-By: lerdsuwa
State-Changed-When: Sat Nov 17 00:14:24 2001
State-Changed-Why:
Confirmed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4884&database=gcc
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2002-03-27 19:26 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-04 2:47 c++/4884: g++ 3.0.2 problem with -fvolatile asharji
2001-11-08 11:13 lerdsuwa
2001-11-08 11:36 lerdsuwa
2001-11-16 9:09 lerdsuwa
2002-03-25 10:53 mmitchel
2002-03-26 10:38 mmitchel
2002-03-26 15:26 Ashif S. Harji
2002-03-27 11:26 Mark Mitchell
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).