From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1151 invoked by alias); 19 Nov 2002 02:26:01 -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 1120 invoked by uid 71); 19 Nov 2002 02:26:00 -0000 Resent-Date: 19 Nov 2002 02:26:00 -0000 Resent-Message-ID: <20021119022600.1116.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, gkmohan@ece.arizona.edu Received: (qmail 19568 invoked by uid 61); 19 Nov 2002 02:24:05 -0000 Message-Id: <20021119022405.19567.qmail@sources.redhat.com> Date: Mon, 25 Nov 2002 08:46:00 -0000 From: gkmohan@ece.arizona.edu Reply-To: gkmohan@ece.arizona.edu To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/8631: bug in typecasting the return value of a function X-SW-Source: 2002-11/txt/msg00936.txt.bz2 List-Id: >Number: 8631 >Category: c++ >Synopsis: bug in typecasting the return value of a function >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Mon Nov 18 18:26:00 PST 2002 >Closed-Date: >Last-Modified: >Originator: gkmohan@ece.arizona.edu >Release: unknown-1.0 >Organization: >Environment: >Description: typecasting a function pointer to return different value seg faults or returns nonsense (depending on the version) this is what g++ -v returns ----------------------------------------------------- Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85) ----------------------------------------------------- --file test.cc-- #include #include #define CAST complex int f1( int x ) { return x; } void f2( CAST (*f)(int), int x ) { cout << (*f)(x); } main() { f2( (CAST (*)(int)) &f1, 4 ); } >How-To-Repeat: g++ -o test test.cc ./test >Fix: :-< none >Release-Note: >Audit-Trail: >Unformatted: