Bug#108663: Help with bug #108663
> I know this bug doesn't belong to my package, but I don't yet know where to
> reassign it. It is definitely related to g++, and may be specific to hppa.
> Could someone take a look at it and see if they can make any sense of it?
>
> The problem involves the operation of this small test program:
>
> #define _BSD_SOURCE
> #include <netinet/udp.h>
>
> void f(void) {
> struct udphdr header;
> header.uh_sport = 0;
> }
>
> Which works with both gcc and g++ on i386, and works with gcc on hppa, but
> fails on hppa with g++. See the BTS for details:
>
> http://bugs.debian.org/108663
Hrm... whom to assign blame?
The udphdr struct is encased in #ifdef __FAVOR_BSD which is set in:
/usr/include/features.h (part of glibc)
---
/* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */
#if defined _BSD_SOURCE && \
!(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \
defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED || \
defined _GNU_SOURCE || defined _SVID_SOURCE)
# define __FAVOR_BSD 1
#endif
---
Though it seems the comment is backwards?
Since setting any of those will cause __FAVOR_BSD to stay unset...
udp.h -> cdefs.h -> features.h -> (no more includes)
Logical assumption:
Some define somewhere is setting one of those?
or
Something is undef'ing _BSD_SOURCE
So I begin ripping out the defines in the boolean expression of features.h
<Carlos plunks away>
Hrm... I've removed all of them. It just seems like _BSD_SOURCE is
_not_ defined even though it _is_ defined in the source (gcc issue?).
#ifdef _BSD_SOURCE
# define __FALSE_DEFINE 1
#else
# define __FAVOR_BSD 1
#endif
Works. Because _BSD_SOURCE is _not_ defined (even though it is :).
---
So I try:
#undef _BSD_SOURCE
#define _BSD_SOURCE
#include <netinet/udp.h>
void f(void) {
struct udphdr header;
header.uh_sport = 0;
}
int main(void) {
f();
return 0;
}
It works. And oddly enough, it continues to work thereafter
even if I remove the #undef line @_@
I haven't tried rebooting and seeing what happens (the 712/60 I have
has a tendency to be tempermental, I'll try it tommorow when I'm there
physically)
I'm not sure who to blame!
gcc isn't as stateful as glibc, and this problem seems like a bug
in glibc... hung jury.
On another note...
My current understanding:
2.2.3-9 - Doesn't compile anymore on HPPA with gcc 3.0.2
2.2.4-1 - Merging changes to get it to compile without dying
I'm helping along with the work for 2.2.4-1 on HPPA.
Some people have decided to wait until the next compiler comes out
in order to fix other issues.
Currently 2.2.4-1 dies randomly with a seg'ing Zic while
walking timezones... odd :}
Hope this helps with understanding the problem.
Get someone to try the 'undef' beforehand case.
Cheers,
Carlos O'Donell Jr.
Reply to: