public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/7129: C++ min/max assignment operators (<?= and >?=) with structs cause segmentation fault in 3.x
@ 2002-07-11  7:34 lerdsuwa
  0 siblings, 0 replies; 2+ messages in thread
From: lerdsuwa @ 2002-07-11  7:34 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jldavis+gcc, nobody

Synopsis: C++ min/max assignment operators (<?= and >?=) with structs cause segmentation fault in 3.x

State-Changed-From-To: open->analyzed
State-Changed-By: lerdsuwa
State-Changed-When: Thu Jul 11 07:34:20 2002
State-Changed-Why:
    Confirmed.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7129


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c++/7129: C++ min/max assignment operators (<?= and >?=) with structs cause segmentation fault in 3.x
@ 2002-06-25 18:16 jldavis
  0 siblings, 0 replies; 2+ messages in thread
From: jldavis @ 2002-06-25 18:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7129
>Category:       c++
>Synopsis:       C++ min/max assignment operators (<?= and >?=) with structs cause segmentation fault in 3.x
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 25 18:06:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.1
>Organization:
Oberlin College Computer Science
>Environment:
System: Linux pippin.cs.oberlin.edu 2.4.17 #15 Fri Feb 1 14:02:22 EST 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.1/configure --prefix=/usr/public --program-suffix=3
>Description:

  Using the min/max-with-assignment operators (<?= and >?=; a GNU
  extension to C++) where one or both of the arguments are of
  aggregate type (struct/class), causes an internal error
  (Segmentation fault).  It doesn't matter if the relevant relational
  operator (< or >) has been defined for the types; an attempt to
  declare <?= or >?= itself for such types causes the error to occur
  on that line instead.  If primitive types are used (pointers count
  for this) for both types, the code compiles successfully if
  comparison is defined on both types, or gives the correct error if
  it isn't (e.g. char* and double).
  
  This doesn't occur with just <? and >?; interestingly, the
  assignment forms don't seem to actually be documented in the manual,
  but do work on primitive types.

>How-To-Repeat:
  Fortunately, this requires no includes or preprocessing.  Example:
// code starts here
struct s_t { };
void foo(void) { 
  s_t s; int i;
  s<?=i;
}
// output starts here
bugtest.cc: In function `void foo()':
bugtest.cc:4: internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
// end.

  Also try trivial modifications: switching the args on line 4, using
  "s" for both of them, using "i" for both of them, removing the '=',
  etc.; this is mainly how I got the details in the Description.
  
>Fix:
  This extension doesn't provide any functionality not present in the
  core language; it can be worked around by writing in terms of
  standard language primitives, the non-assignment forms of the
  extension operators, or using the min() and max() templates from the
  standard header "algorithm".
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-07-11 14:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-11  7:34 c++/7129: C++ min/max assignment operators (<?= and >?=) with structs cause segmentation fault in 3.x lerdsuwa
  -- strict thread matches above, loose matches on Subject: below --
2002-06-25 18:16 jldavis

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