public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Steve Wadsworth <Steve_Wadsworth@portasystems.co.uk> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: RE: c++/9942: Function Overload Resolution calls wrong function o n variable length parameter lists Date: Wed, 05 Mar 2003 18:06:00 -0000 [thread overview] Message-ID: <20030305180601.12732.qmail@sources.redhat.com> (raw) The following reply was made to PR c++/9942; it has been noted by GNATS. From: Steve Wadsworth <Steve_Wadsworth@portasystems.co.uk> To: "'bangerth@dealii.org'" <bangerth@dealii.org>, "'gcc-bugs@gcc.gnu.org'" <gcc-bugs@gcc.gnu.org>, "'gcc-prs@gcc.gnu.org'" <gcc-prs@gcc.gnu.org>, "'nobody@gcc.gnu.org'" <nobody@gcc.gnu.org>, "'gcc-gnats@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 <stdarg.h> #include <stdio.h> #include <unistd.h> #include <string> using namespace std; #include <stdio.h> 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--
next reply other threads:[~2003-03-05 18:06 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-03-05 18:06 Steve Wadsworth [this message] 2003-03-05 23:06 Wolfgang Bangerth
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030305180601.12732.qmail@sources.redhat.com \ --to=steve_wadsworth@portasystems.co.uk \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).