From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12748 invoked by alias); 5 Mar 2003 18:06: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 12733 invoked by uid 71); 5 Mar 2003 18:06:01 -0000 Date: Wed, 05 Mar 2003 18:06:00 -0000 Message-ID: <20030305180601.12732.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Steve Wadsworth Subject: RE: c++/9942: Function Overload Resolution calls wrong function o n variable length parameter lists Reply-To: Steve Wadsworth X-SW-Source: 2003-03/txt/msg00223.txt.bz2 List-Id: The following reply was made to PR c++/9942; it has been noted by GNATS. From: Steve Wadsworth To: "'bangerth@dealii.org'" , "'gcc-bugs@gcc.gnu.org'" , "'gcc-prs@gcc.gnu.org'" , "'nobody@gcc.gnu.org'" , "'gcc-gnats@gcc.gnu.org'" Cc: Subject: RE: c++/9942: Function Overload Resolution calls wrong function o n variable length parameter lists Date: Wed, 5 Mar 2003 18:11:36 -0000 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C2E342.A968F590 Content-Type: text/plain; charset="iso-8859-1" Hi Wolfgang, Right now I'm having great difficulty reproducing this problem. The files I posted on the problem report are flawed I notice, hence it appears to exhibit my problem, but it's actually legitimate as I've renamed one of the function instances with a different name. I've gone back to my original source code - which is a rather large project build, with the "ServiceAppLight" and "Logger" classes in a statically linked library, to see if this was actually causing the compiler to exhibit the problem and I've now discovered that my original bug report was wrong. I'm not sure if this is a bug - but I now realise what my original problem is, and it's not what I reported. It's still function overload resolution, and it still works OK on the gcc with the previous version of Red Hat Linux, and with Tru64. It's where the call to the logEvent function has a character pointer as it's argument - then it gets a segment violation. Attached is sample code to exhibit this. Regards, Steve -----Original Message----- From: bangerth@dealii.org [mailto:bangerth@dealii.org] Sent: 04 March 2003 22:39 To: Steve_Wadsworth@Portasystems.co.uk; gcc-bugs@gcc.gnu.org; gcc-prs@gcc.gnu.org; nobody@gcc.gnu.org Subject: Re: c++/9942: Function Overload Resolution calls wrong function on variable length parameter lists Synopsis: Function Overload Resolution calls wrong function on variable length parameter lists State-Changed-From-To: open->feedback State-Changed-By: bangerth State-Changed-When: Tue Mar 4 22:38:56 2003 State-Changed-Why: This is one of the rare cases where it would be helpful if we would have the original code from which you got the preprocessed one. I gather that it is relatively small, but I can't recreate the va_start calls etc. Could you possibly send them to me? Thanks Wolfgang http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p r=9942 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. postmaster@portasystems.co.uk This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ********************************************************************** ------_=_NextPart_000_01C2E342.A968F590 Content-Type: application/octet-stream; name="TestEventLog.cpp" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="TestEventLog.cpp" /***********************************************************************= **/ /* = */ /* COPYRIGHT (c), 2002, Porta Systems Ltd. = */ /* All rights reserved. Any unauthorised reproduction is strictly = */ /* prohibited. = */ /* = */ #include #include #include #include using namespace std; #include class Logger { public: enum EventType { DebugEvent =3D 0x01, StatusEvent =3D 0x02, InfoEvent =3D 0x04, WarnEvent =3D 0x08, ErrorEvent =3D 0x10, SystemEvent =3D 0x20, FatalEvent =3D 0x40 }; // logging static void logEvent(EventType eventType, const char* eventId, = const char* format, ...); static void logEvent(EventType eventType, const char* eventId, = const char* format, va_list& args); // To allow indirect calling via = another function }; void Logger::logEvent(EventType eventType, const char* eventId, const = char* format, ...) { // format event message char eventMsg[4196]; va_list args; va_start(args, format); vsprintf(eventMsg, format, args); va_end(args); } void Logger::logEvent(EventType eventType, const char* eventId, const = char* format, va_list& args) { // format event message char eventMsg[4196]; vsprintf(eventMsg, format, args); } class ServiceAppLight { public: // logging static void logEvent(Logger::EventType eventType, const char* = eventId, const char* format, ...); }; void ServiceAppLight::logEvent(Logger::EventType eventType, const char* = eventId, const char* format, ...) { va_list args; va_start(args, format); Logger::logEvent(eventType, eventId, format, args); va_end(args); } class MsgMoverService : public ServiceAppLight { public: MsgMoverService(); int runService(int argc, char** argv); }; MsgMoverService::MsgMoverService(): ServiceAppLight() { } int MsgMoverService::runService(int argc, char** argv) { char *Temp ; Temp =3D "Test String" ; Logger::logEvent(Logger::DebugEvent, "TEST", "Test Call %s", Temp); } int main(int argc, char** argv) { MsgMoverService msgMoverService; msgMoverService.runService(argc, argv); } ------_=_NextPart_000_01C2E342.A968F590--