From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28856 invoked by alias); 26 Jun 2002 01:06:05 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 28830 invoked by uid 71); 26 Jun 2002 01:06:02 -0000 Resent-Date: 26 Jun 2002 01:06:02 -0000 Resent-Message-ID: <20020626010602.28829.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, jldavis+gcc@cs.oberlin.edu Received: (qmail 25187 invoked from network); 26 Jun 2002 01:03:11 -0000 Received: from unknown (HELO pippin.cs.oberlin.edu) (132.162.201.205) by sources.redhat.com with SMTP; 26 Jun 2002 01:03:11 -0000 Received: (from jldavis@localhost) by pippin.cs.oberlin.edu (8.11.4/8.11.4) id g5Q136Z15412; Tue, 25 Jun 2002 21:03:06 -0400 Message-Id: <200206260103.g5Q136Z15412@pippin.cs.oberlin.edu> Date: Tue, 25 Jun 2002 18:16:00 -0000 From: jldavis@cs.oberlin.edu Reply-To: jldavis+gcc@cs.oberlin.edu To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: 3.113 Subject: c++/7129: C++ min/max assignment operators (?=) with structs cause segmentation fault in 3.x X-SW-Source: 2002-06/txt/msg00620.txt.bz2 List-Id: >Number: 7129 >Category: c++ >Synopsis: C++ min/max assignment operators (?=) 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 (?=; 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 ?= 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 ?; 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; sFix: 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: