Bug 7618 - [3.3/3.4/4.0 Regression] GCC 3.x vararg disallowed in virtual function
Summary: [3.3/3.4/4.0 Regression] GCC 3.x vararg disallowed in virtual function
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.1
: P2 normal
Target Milestone: 3.4.0
Assignee: Eric Christopher
URL:
Keywords: patch, rejects-valid
: 11982 (view as bug list)
Depends on:
Blocks: 14454
  Show dependency treegraph
 
Reported: 2002-08-16 15:36 UTC by ba22
Modified: 2004-09-13 14:15 UTC (History)
6 users (show)

See Also:
Host:
Target: mips-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-12-19 08:20:59


Attachments
snip.i (5.05 KB, text/x-c)
2003-05-21 15:16 UTC, ba22
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ba22 2002-08-16 15:36:00 UTC
(gcc-3.1/gcc/cp/method.c:428)

DefaultPrintfPort.cxx:20: generic thunk code fails for method `virtual void
   DefaultPrintfPort::p(char*, ...)' which uses `...'

Release:
3.1

Environment:
Reading specs from /home/baallan/gcj/311_nothreads/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs Configured with: ../../gcj/gcc-3.1/configure --prefix=/home/baallan/gcj/311_nothreads --enable-threads=single Thread model: single gcc version 3.1

redhat linux 7.3
mandrake linux 8.0
i686
no LD_LIBRARY_PATH set
/home/baallan/bin:/home/baallan/mpich124-311_nothreads/bin:/home/baallan/gcj/311_nothreads/bin:/usr/kerberos/bin:/usr/local/java/j2sdk1.4.0_01/bin:/usr/local/gcc/3.1/bin:/usr/local/bin:/bin:/usr/bin:/home/baallan/bin:/usr/X11R6/bin

How-To-Repeat:
g++ snip.i
# run the file attachment through g++ w/no arguments
Comment 1 ba22 2002-08-16 15:36:00 UTC
Fix:
unknown. if production is illegal (no ellipsis in c++ virt funcs?)
change error message to compliance warning/error.
Comment 2 Nathan Sidwell 2002-09-13 15:48:13 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: known bug with thunk code
Comment 3 Giovanni Bajo 2003-05-02 12:26:21 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Reduced snippet:
    -------------------------------------------------
    struct A 
    {
        virtual void func(...) = 0;
    };
    
    struct B : virtual A
    {
        virtual void func(...);
    };
    
    void B::func(...) 
    {}
    -------------------------------------------------
    pr7618.cpp:12: generic thunk code fails for method `virtual void B::func(...)' which uses `...'
    
    Fixed in 3.3 CVS 20030421 and 3.4 CVS 20030430. It might
    have been fixed in 3.2.3 as well.
Comment 4 Volker Reichelt 2003-05-20 09:12:09 UTC
State-Changed-From-To: closed->analyzed
State-Changed-Why: The bug is still present on mips-sgi-irix6.5 (3.3 branch,
    mainline).
Comment 5 Andrew Pinski 2003-08-19 23:32:56 UTC
*** Bug 11982 has been marked as a duplicate of this bug. ***
Comment 6 Andrew Pinski 2003-08-19 23:35:31 UTC
I can reproduce this in 3.3.2 (20030815) on powerpc-apple-darwin6.6.
It might also happen on other targets, it is target dependent because where it fails is after 
calling targetm.asm_out.can_output_mi_thunk.
Comment 7 Andrew Pinski 2003-08-19 23:40:10 UTC
The change which fixed this on the mainline is for PPC is:
2003-01-08  David Edelsohn
        * config/rs6000/rs6000.h (FUNCTION_MODE): Always use SImode.
        * config/rs6000/rs6000.c (TARGET_ASM_CAN_OUTPUT_MI_THUNK): Redefine
        as hook_bool_tree_hwi_hwi_tree_true.
        (rs6000_emit_allocate_stack): Use TARGET_32BIT.      
        (rs6000_emit_epilogue): Same.
        (rs6000_output_mi_thunk): Re-implement as RTL.
        * config/rs6000/xcoff.h (ASM_DECLARE_FUNCTION_NAME): Call
        xcoffout_declare_function if any debugging enabled.      

So it looks like every target needs to do something like this which means it is most likely 
will not be fixed for 3.3.
Comment 8 Andrew Pinski 2003-08-24 20:14:58 UTC
2.95.3 accepted this, note this is only 3.3 regression for powerpc-*-*, mips has not been fixed on 
the mainline yet, there might be other targets which do not accept this.
Here are a listof targets (or I think will not accept this by looking at the config files) which does not 
accept this:
arc
avr
c4x
d30x
dsp16xx
fr30
h8300
i370
i860
i960
ip2k
iq2000
m32r
m68hc11
m88k
mcore
mips
mmix
mn10300
ns32k
pdp11
v850
xtensa
Comment 9 Andrew Pinski 2003-12-26 01:52:44 UTC
The only major target in this is MIPS.
Comment 10 Andrew Pinski 2003-12-30 00:58:14 UTC
Eric says he will deal with this for MIPS at least.
Comment 11 Ian Lance Taylor 2004-01-13 19:23:55 UTC
I posted a sample patch for the MIPS backend here:
http://gcc.gnu.org/ml/gcc-patches/2004-01/msg01199.html

This needs to be checked by someone with access to real hardware.
Comment 12 GCC Commits 2004-01-18 09:45:09 UTC
Subject: Bug 7618

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	rsandifo@gcc.gnu.org	2004-01-18 09:44:59

Modified files:
	gcc            : ChangeLog 
	gcc/config/mips: mips.c 

Log message:
	PR target/7618
	* config/mips/mips.c: Include cfglayout.h.
	(TARGET_ASM_OUTPUT_MI_THUNK, TARGET_ASM_CAN_OUTPUT_MI_THUNK): Define.
	(mips_unspec_offset_high): Add temporary register argument.
	(mips_load_call_address): New function, split out from...
	(mips_expand_call): ...here.
	(mips_output_cplocal): New function.
	(mips_output_function_prologue, mips_output_function_epilogue): Use it.
	(mips_emit_loadgp): New function, split out from...
	(mips_expand_prologue): ...here.
	(mips_output_mi_thunk): New function.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.16&r2=2.2326.2.17
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/mips/mips.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.362&r2=1.362.4.1

Comment 13 Richard Sandiford 2004-01-18 10:00:56 UTC
Patch for MIPS committed.  Given Andrew's comment:

    The only major target in this is MIPS.

and given that this PR is specifically against the MIPS port, I'll go
ahead and close it.
Comment 14 Gabriel Dos Reis 2004-01-18 11:48:03 UTC
Subject: Re:  [3.3/3.4/3.5 Regression] GCC 3.x vararg disallowed in virtual function

"rsandifo at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| Patch for MIPS committed.  Given Andrew's comment:
| 
|     The only major target in this is MIPS.
| 
| and given that this PR is specifically against the MIPS port, I'll go
| ahead and close it.

Do you intend to have it fixed on gcc-3_3-branch too?

-- Gaby
Comment 15 Giovanni Bajo 2004-01-18 11:51:34 UTC
Richard, from the commit message, it looks like this went in in the gcc-3_4-
branch only. But this is a 3.3/3.4/3.5 regression, so you should port your fix 
at least to mainline too. Also, as Gaby have just asked, is it 
possible/feasable to backport this to the 3.3 branch as well?
Comment 16 Richard Sandiford 2004-01-18 11:55:43 UTC
Subject: Re:  [3.3/3.4/3.5 Regression] GCC 3.x vararg
 disallowed in virtual function

"giovannibajo at libero dot it" <gcc-bugzilla@gcc.gnu.org> writes:
> Richard, from the commit message, it looks like this went in in the gcc-3_4-
> branch only. But this is a 3.3/3.4/3.5 regression, so you should port your fix 
> at least to mainline too.

It went into both, I just forgot to add the PR marker when making
the initial mainline commit.  FWIW, I did add it afterwards, but that
didn't seem to trigger the automatic message.

> Also, as Gaby have just asked, is it possible/feasable to backport
> this to the 3.3 branch as well?

Not really.  The port has changed too much in the meantime.

Richard
Comment 17 Gabriel Dos Reis 2004-01-18 16:02:22 UTC
Subject: Re:  [3.3/3.4/3.5 Regression] GCC 3.x vararg disallowed in virtual function

"rsandifo at redhat dot com" <gcc-bugzilla@gcc.gnu.org> writes:

| > Also, as Gaby have just asked, is it possible/feasable to backport
| > this to the 3.3 branch as well?
| 
| Not really.  The port has changed too much in the meantime.

OK. Thanks!

-- Gaby