| Summary: | kernel builds on March 12th -stable fail | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Michael Conlen <meconlen> |
| Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 4.2-STABLE | ||
| Hardware: | Any | ||
| OS: | Any | ||
I forgot to mention...
Normally I can track down these things, but this is just weird. The only
thing I can think of is that the current gcc is not accepting variables
defined anywhere but the top of the function and is treating the var
definition as something weird.
sure enough
# cat a.c
main() {
printf("hello world\n");
int a;
a = 1;
printf("hello world %d\n", a);
}
# cc a.c
a.c: In function `main':
a.c:3: syntax error before `int'
a.c:4: `a' undeclared (first use in this function)
a.c:4: (Each undeclared identifier is reported only once
a.c:4: for each function it appears in.)
# cat a.c
main() {
int a;
printf("hello world\n");
a = 1;
printf("hello world %d\n", a);
}
# cc a.c
This seems to be the problem!
Gotta love copy and paste limits...
--
Groove On Dude
Michael Conlen
Obfuscated Networking
meconlen@obfuscated.net
State Changed From-To: open->feedback Is this a duplicate of PR kern/25651, which also contains a patch? Does the patch in http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25651 solve the problem? State Changed From-To: feedback->closed Duplicate of kern/25651. |
#make buildkernel KERNCONF=ENO <snip> /usr/src/sys/netinet/tcp_usrreq.c: In function `tcp_usr_accept': /usr/src/sys/netinet/tcp_usrreq.c:424: syntax error before `int' /usr/src/sys/netinet/tcp_usrreq.c:424: `ostate' undeclared (first use in this function) /usr/src/sys/netinet/tcp_usrreq.c:424: (Each undeclared identifier is reported only once /usr/src/sys/netinet/tcp_usrreq.c:424: for each function it appears in.) /usr/src/sys/netinet/tcp_usrreq.c:418: warning: `tp' might be used uninitialized in this function *** Error code 1 Stop in /usr/obj/usr/src/sys/ENO. Investigation shows the following tcp_usr_accept(struct socket *so, struct sockaddr **nam) { int s = splnet(); int error = 0; struct inpcb *inp = sotoinpcb(so); struct tcpcb *tp; if (so->so_state & SS_ISDISCONNECTED) { error = ECONNABORTED; goto out; } COMMON_START(); in_setpeeraddr(so, nam); COMMON_END(PRU_ACCEPT); } Line 424 is COMMON_START(); which is #define COMMON_START() TCPDEBUG0; \ do { \ if (inp == 0) { \ splx(s); \ return EINVAL; \ } \ tp = intotcpcb(inp); \ TCPDEBUG1(); \ } while(0) TCPDEBUG0 is defined with #ifdef TCPDEBUG #define TCPDEBUG0 int ostate #define TCPDEBUG1() ostate = tp ? tp->t_state : 0 #define TCPDEBUG2(req) if (tp && (so->so_options & SO_DEBUG)) \ tcp_trace(TA_USER, ostate, tp, 0, 0, req) #else #define TCPDEBUG0 #define TCPDEBUG1() #define TCPDEBUG2(req) #endif Here we can see why the option in the conf file matters, however, the definition seems to be fine. Now, tracking down if it might be some other macro I only found # cd /usr/include/netinet # grep SS_ISDISCONNECTED *h # cd ../sys # grep SS_ISDISCONNECTED *h socketvar.h:#define SS_ISDISCONNECTED 0x2000 /* socket disconnected from peer */ # cd ../net # grep SS_ISDISCONNECTED *h # Fix: First fix is to turn off TCPDEBUG. the second fix (actually fixing the code) is a lot harder, because the TCPDEBUG2 code references the variable. That code is in COMMON_END, so you can't just wrap COMMON_START in {}... ...I'll let you guys sort it out... ...and what is goto doing in there? Looks like the code could use some work in general... BTW: I submitted this to -stable before I remembered the pr database, so someone might move it in here from there as well, it would be a dup.