public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: mlelstv@dev.de.cw.net
To: gcc-gnats@gcc.gnu.org
Subject: optimization/9775: -O3 complains about stdarg functions
Date: Thu, 20 Feb 2003 16:06:00 -0000	[thread overview]
Message-ID: <20030220160515.13510.qmail@sources.redhat.com> (raw)


>Number:         9775
>Category:       optimization
>Synopsis:       -O3 complains about stdarg functions
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 20 16:06:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Michael van Elst
>Release:        gcc-3.2.2
>Organization:
>Environment:
FreeBSD dt4.dev.de.cw.net 4.7-STABLE FreeBSD 4.7-STABLE #0: Fri Oct 11 18:32:25 CEST 2002     root@dt4.dev.de.cw.net:/usr/src/sys/compile/DT4  i386

Reading specs from /cw/lib/gcc-lib/i386-unknown-freebsd4.7/3.2.2/specs
Configured with: ../configure --prefix=/cw --exec-prefix=/cw --includedir=/cw/include/gcc --with-gxx-include-dir=/cw/include/g++ --with-local-prefix=/cw/lib/gcc-lib --enable-languages=c,c++ --enable-threads=posix --disable-maintainer-mode --disable-shared --disable-nls --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 3.2.2

>Description:
gcc does not compile the following source with -O3, smaller optimization levels do work fine. The error reported is:

% gcc -O3 -c c.c
c.c: In function `bar':
c.c:8: `va_start' used in function with fixed args
c.c:8: `va_start' used in function with fixed args

-- snip --

#include <stdarg.h>

int foo(int c, ...)
{
    va_list ap;
    int a, s=0;

    va_start(ap,c);
    while (c > 0) {
        a = va_arg(ap, int);
        c += a;
    }
    va_end(ap);
    return s;
}

int bar(void)
{
    return foo(4,1,2,3,4) + foo(2,9,5);
}
>How-To-Repeat:
see above. The same happens with gcc-3.2.1 but not with gcc-2.95.4
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


                 reply	other threads:[~2003-02-20 16:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20030220160515.13510.qmail@sources.redhat.com \
    --to=mlelstv@dev.de.cw.net \
    --cc=gcc-gnats@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: link
Be 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).