public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Bug with -finline-functions and va_start on FreeBSD
@ 2003-01-29 19:40 Bill Wendling
  2003-01-29 21:41 ` Joe Buck
  2003-01-30  8:44 ` Loren James Rittle
  0 siblings, 2 replies; 6+ messages in thread
From: Bill Wendling @ 2003-01-29 19:40 UTC (permalink / raw)
  To: gcc

Hi all,

I'm having a problem with gcc 3.2.1 on FreeBSD 4.7-STABLE for this piece
of code:

#include <stdio.h>
#include <stdarg.h>

int foo(const char *fmt, ...)
{
    va_list ap;

    va_start(ap, fmt);
    vprintf(fmt, ap);
    va_end(ap);
}

int main(int argc, char **argv)
{
    foo("hello %s\n", "world");
    return 0;
}

When compiling with the following options:

    % gcc32 -o t t.c -finline-functions -fomit-frame-pointer -O2

I get this error:

t.c: In function `main':
t.c:8: `va_start' used in function with fixed args

Is this a known problem? Is there a fix for this in the next release of
gcc? :-)

Thanks!

-- 
|| Bill Wendling            "Real Programmers have a Snoopy Calendar
|| wendling@ncsa.uiuc.edu    of '69 hanging on their wall"
|| Coding Simian                       -- Toon Moene

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug with -finline-functions and va_start on FreeBSD
  2003-01-29 19:40 Bug with -finline-functions and va_start on FreeBSD Bill Wendling
@ 2003-01-29 21:41 ` Joe Buck
  2003-01-29 22:31   ` Bill Wendling
  2003-01-30  8:44 ` Loren James Rittle
  1 sibling, 1 reply; 6+ messages in thread
From: Joe Buck @ 2003-01-29 21:41 UTC (permalink / raw)
  To: Bill Wendling; +Cc: gcc

On Wed, Jan 29, 2003 at 12:30:55PM -0600, Bill Wendling wrote:
> I'm having a problem with gcc 3.2.1 on FreeBSD 4.7-STABLE for this piece
> of code:
> 
> #include <stdio.h>
> #include <stdarg.h>
> 
> int foo(const char *fmt, ...)
> {
>     va_list ap;
> 
>     va_start(ap, fmt);
>     vprintf(fmt, ap);
>     va_end(ap);
> }
> 
> int main(int argc, char **argv)
> {
>     foo("hello %s\n", "world");
>     return 0;
> }
> 
> When compiling with the following options:
> 
>     % gcc32 -o t t.c -finline-functions -fomit-frame-pointer -O2
> 
> I get this error:
> 
> t.c: In function `main':
> t.c:8: `va_start' used in function with fixed args
> 
> Is this a known problem? Is there a fix for this in the next release of
> gcc? :-)

I can't duplicate this report on GNU/Linux; also, it's unclear as to
just what release you are using.  Given that, if you haven't filed a PR,
it's not a known problem.  Please file one.
 
> Thanks!
> 
> -- 
> || Bill Wendling            "Real Programmers have a Snoopy Calendar
> || wendling@ncsa.uiuc.edu    of '69 hanging on their wall"
> || Coding Simian                       -- Toon Moene

-- 
Q. What's more of a headache than a bug in a compiler.
A. Bugs in six compilers.  -- Mark Johnson

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug with -finline-functions and va_start on FreeBSD
  2003-01-29 21:41 ` Joe Buck
@ 2003-01-29 22:31   ` Bill Wendling
  0 siblings, 0 replies; 6+ messages in thread
From: Bill Wendling @ 2003-01-29 22:31 UTC (permalink / raw)
  To: Joe Buck; +Cc: gcc

Also sprach Joe Buck:
} 
} I can't duplicate this report on GNU/Linux; also, it's unclear as to
} just what release you are using.  Given that, if you haven't filed a PR,
} it's not a known problem.  Please file one.
}  
I did. We're not experiencing this on our GNU/Linux box either (using gcc
3.2.1 as well). It's odd for sure...

-- 
|| Bill Wendling            "Real Programmers have a Snoopy Calendar
|| wendling@ncsa.uiuc.edu    of '69 hanging on their wall"
|| Coding Simian                       -- Toon Moene

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug with -finline-functions and va_start on FreeBSD
  2003-01-29 19:40 Bug with -finline-functions and va_start on FreeBSD Bill Wendling
  2003-01-29 21:41 ` Joe Buck
@ 2003-01-30  8:44 ` Loren James Rittle
  2003-01-30  9:26   ` Bill Wendling
  1 sibling, 1 reply; 6+ messages in thread
From: Loren James Rittle @ 2003-01-30  8:44 UTC (permalink / raw)
  To: gcc; +Cc: wendling

In article <20030129183055.GA29947@ncsa.uiuc.edu> you write:

> I'm having a problem with gcc 3.2.1 on FreeBSD 4.7-STABLE for this piece
> of code:
>
> #include <stdio.h>
> #include <stdarg.h>
[...]
> When compiling with the following options:
>
>    % gcc32 -o t t.c -finline-functions -fomit-frame-pointer -O2
>
> I get this error:

Your example works fine with gcc 3.2.1 and gcc 3.2.2 (prerelease)
built from FSF sources on i386-unknown-freebsd4.7.  Based solely upon
the name you used to invoke the compiler, I suspect that you are
reporting a bug with a "FreeBSD ports" version of gcc.  If I'm
correct, then please file it with freebsd.org not gcc.gnu.org.

To help yourself, please run this command on your machine:

% gcc32 -E t.c | grep /usr/local | nawk '{print $3}' | sort | uniq 

If you don't see:

"/usr/local/lib/gcc-lib/i386-unknown-freebsd4.7/3.2.1/include/machine/ansi.h"
"/usr/local/lib/gcc-lib/i386-unknown-freebsd4.7/3.2.1/include/stdarg.h"

Then the bug to report to FreeBSD is this (or figure out yourself how
to fix the port ;-): "stdarg.h not installed when gcc built from
ports" & "fixincludes not run when gcc built from ports".

If you see the 2 lines, then, sorry, I have no idea what your problem
is.

> Is this a known problem? Is there a fix for this in the next release of
> gcc? :-)

The current FSF release does not have this problem.  There has been a
bit of a "discussion" over this issue over the years (i.e. it is known
in my mind).  The various BSD distros prefer to fix their system
headers as they break.  The FSF side prefers to assume that all system
headers, from time to time, actually contain minor nits to be
addressed.  Both positions have merit, but you just happened to be hit
by a case when the system header could not predict a change in gcc.

Regards,
Loren

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug with -finline-functions and va_start on FreeBSD
  2003-01-30  8:44 ` Loren James Rittle
@ 2003-01-30  9:26   ` Bill Wendling
  2003-01-30 11:02     ` Loren James Rittle
  0 siblings, 1 reply; 6+ messages in thread
From: Bill Wendling @ 2003-01-30  9:26 UTC (permalink / raw)
  To: Loren James Rittle; +Cc: gcc

Also sprach Loren James Rittle:
} In article <20030129183055.GA29947@ncsa.uiuc.edu> you write:
} 
} > I'm having a problem with gcc 3.2.1 on FreeBSD 4.7-STABLE for this piece
} > of code:
} >
} > #include <stdio.h>
} > #include <stdarg.h>
} [...]
} > When compiling with the following options:
} >
} >    % gcc32 -o t t.c -finline-functions -fomit-frame-pointer -O2
} >
} > I get this error:
} 
} Your example works fine with gcc 3.2.1 and gcc 3.2.2 (prerelease)
} built from FSF sources on i386-unknown-freebsd4.7.  Based solely upon
} the name you used to invoke the compiler, I suspect that you are
} reporting a bug with a "FreeBSD ports" version of gcc.  If I'm
} correct, then please file it with freebsd.org not gcc.gnu.org.
} 
I'm not sure what you mean by a "FreeBSD ports" version of gcc. I'm not a
FreeBSD hacker...more of a GNU/Linux one :-). As for the name of the
compiler, I'm not sure if it's one that our sysadmin picked up off of the
'net or built by himself (we have several versions of gcc to try our
software against).

} To help yourself, please run this command on your machine:
} 
} % gcc32 -E t.c | grep /usr/local | nawk '{print $3}' | sort | uniq 
} 
} If you don't see:
} 
} "/usr/local/lib/gcc-lib/i386-unknown-freebsd4.7/3.2.1/include/machine/ansi.h"
} "/usr/local/lib/gcc-lib/i386-unknown-freebsd4.7/3.2.1/include/stdarg.h"
} 
} Then the bug to report to FreeBSD is this (or figure out yourself how
} to fix the port ;-): "stdarg.h not installed when gcc built from
} ports" & "fixincludes not run when gcc built from ports".
} 
} If you see the 2 lines, then, sorry, I have no idea what your problem
} is.
} 
I didn't get those lines but got these:

> gcc32 -E t.c | grep include | nawk '{print $3}' | sort | uniq
"/usr/include/stdarg.h"
"/usr/include/stdio.h"
"/usr/include/sys/cdefs.h"
"/usr/sdt/lib/gcc-lib/i386-portbld-freebsd4.7/3.2.1/include/machine/ansi.h"

Would this still qualify then as the FreeBSD problem you're talking
about?

} > Is this a known problem? Is there a fix for this in the next release of
} > gcc? :-)
} 
} The current FSF release does not have this problem.  There has been a
} bit of a "discussion" over this issue over the years (i.e. it is known
} in my mind).  The various BSD distros prefer to fix their system
} headers as they break.  The FSF side prefers to assume that all system
} headers, from time to time, actually contain minor nits to be
} addressed.  Both positions have merit, but you just happened to be hit
} by a case when the system header could not predict a change in gcc.
} 
Hmm...okay. Thanks for the help!

-- 
|| Bill Wendling            "Real Programmers have a Snoopy Calendar
|| wendling@ncsa.uiuc.edu    of '69 hanging on their wall"
|| Coding Simian                       -- Toon Moene

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug with -finline-functions and va_start on FreeBSD
  2003-01-30  9:26   ` Bill Wendling
@ 2003-01-30 11:02     ` Loren James Rittle
  0 siblings, 0 replies; 6+ messages in thread
From: Loren James Rittle @ 2003-01-30 11:02 UTC (permalink / raw)
  To: wendling; +Cc: gcc

In article <20030130044051.GA16724@ncsa.uiuc.edu>,
Bill Wendling<wendling@ncsa.uiuc.edu> writes:

> I'm not sure what you mean by a "FreeBSD ports" version of gcc. I'm not a
> FreeBSD hacker...more of a GNU/Linux one :-).

Ah, sorry Bill; I know how that feels from the other direction. ;-)

> As for the name of the
> compiler, I'm not sure if it's one that our sysadmin picked up off of the
> 'net or built by himself (we have several versions of gcc to try our
> software against).

When the compiler is called gcc32 on a FreeBSD system, it was probably
built using this ports(7) command or the portupgrade(1) equivalent:
``cd /usr/ports/lang/gcc32; make install'' rather than with the FSF
sources directly.  In particular, that build process includes patches
not present in the FSF tree.  (I include this paragraph in this thread
only to fully explain the background context regarding what happened.)

>> gcc32 -E t.c | grep include | nawk '{print $3}' | sort | uniq
> "/usr/include/stdarg.h"
   ^^^^^^^^^^^^ This means that gcc 3.2.1, as installed on your system,
                is not seeing its own copy of <stdarg.h>.
[...]
> "/usr/sdt/lib/gcc-lib/i386-portbld-freebsd4.7/3.2.1/include/machine/ansi.h"
                             ^^^^^^^ FYI, this confirms it was a port build.

> Would this still qualify then as the FreeBSD problem you're talking
> about?

Yes, you have this reportable problem (to freebsd.org not the FSF, please):

"[gcc 3.2.1 version of] stdarg.h not installed when lang/gcc32 port built"

Thank you for the report and confirming the root issue.  BTW, if you
study /usr/ports/lang/gcc32/files/patch-va (on a FreeBSD system with
src ports installed), you will note that if you remove the first thunk
of that patch then your observed problem will go away.  Someone local
to you with knowledge of building FreeBSD ports could fix it for you.

Regards,
Loren

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-01-30  5:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-29 19:40 Bug with -finline-functions and va_start on FreeBSD Bill Wendling
2003-01-29 21:41 ` Joe Buck
2003-01-29 22:31   ` Bill Wendling
2003-01-30  8:44 ` Loren James Rittle
2003-01-30  9:26   ` Bill Wendling
2003-01-30 11:02     ` Loren James Rittle

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).