Actually, there is. In contrast to local variables, C and C++ by default zero-initialize global and static variables at program startup time. For local variables the overhead is too large of course. See http://stackoverflow.com/questions/2091 ... ult-valuesEd Trice wrote:Nooooooo... There is no such guarantee.hgm wrote:I thought in C it is guaranteed that uninitialized global variables start with value 0. So if the OS does ot guarantee this behavior on loading an executable image, the memset must be hidden somewhere in the startup code that eventually calls main().
Help request for debugging ICS
Moderators: hgm, Rebel, chrisw
-
- Posts: 741
- Joined: Tue May 22, 2007 11:13 am
Re: Help request for debugging ICS
-
- Posts: 5566
- Joined: Tue Feb 28, 2012 11:56 pm
Re: Help request for debugging ICS
Why not first check the relevant standard before making unsubstantiated false statements? Or just google...Ed Trice wrote:Nooooooo... There is no such guarantee.hgm wrote:I thought in C it is guaranteed that uninitialized global variables start with value 0. So if the OS does ot guarantee this behavior on loading an executable image, the memset must be hidden somewhere in the startup code that eventually calls main().
-
- Posts: 1342
- Joined: Wed Mar 08, 2006 9:41 pm
- Location: Morgantown, WV, USA
Re: Help request for debugging ICS
Since I ran OICS using your codebase I know the feeling and would be willing to help you out.
backtrace from what I remember was actually just a shell script that did some funky gdb stuff. I dug it up once 3-4 years ago.
Feel free to email me jshriver@gmail.com
backtrace from what I remember was actually just a shell script that did some funky gdb stuff. I dug it up once 3-4 years ago.
Feel free to email me jshriver@gmail.com
-
- Posts: 1342
- Joined: Wed Mar 08, 2006 9:41 pm
- Location: Morgantown, WV, USA
Re: Help request for debugging ICS
Not sure what flavor of Linux you are running but did you recently do an update?
ICS and it's code was very um... let's say specific to things. I could easily see an updated libc and various libs causing problems due to legacy code being removed
ICS and it's code was very um... let's say specific to things. I could easily see an updated libc and various libs causing problems due to legacy code being removed
-
- Posts: 1342
- Joined: Wed Mar 08, 2006 9:41 pm
- Location: Morgantown, WV, USA
Re: Help request for debugging ICS
This very much! When I ran OICS I had to use the older gcc 2.95 (?) compiler to keep things kosher. Mamer even more so.syzygy wrote:Any chance you upgraded the compiler?hgm wrote:After many months of flawless running, the ICS on which I organize the monthly blitz tournaments suddenly became crash prone in October, and now typically crashes within the hour. Nothing was changed, neither in the ICS nor in the OS of the VPS it is running on.
-
- Posts: 27808
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Help request for debugging ICS
I am trying to silence the flood of warnings that compiling the ICS produces, to be able to see if there is anything serious there. But can anyone explain me how it is possible that the following code:
Produces (several times) the warning
utils.c:673: warning: passing argument 1 of ‘strlen’ from incompatible pointer type
/usr/include/string.h:397: note: expected ‘const char *’ but argument is of type ‘char (*)[100]’
? The strlen in the above code does have argument 'want', which is a formal parameter of the function declared as (const char *). So where does this 'char (*)[100]' nonsense from? Does it try to in-line the routine somewhere, in a place where it is called with an actual parameter of the wrong type?
Code: Select all
static void t_sft(const char *want, struct t_tree *t)
{
if (t) {
int cmp = strncmp(want, &t->name, strlen(want));
if (cmp <= 0) /* if want <= this one, look left */
t_sft(want, t->left);
if (t_buffersize && (cmp == 0)) { /* if a match, add it to buffer */
t_buffersize--;
*t_buffer++ = &(t->name);
}
if (cmp >= 0) /* if want >= this one, look right */
t_sft(want, t->right);
}
}
utils.c:673: warning: passing argument 1 of ‘strlen’ from incompatible pointer type
/usr/include/string.h:397: note: expected ‘const char *’ but argument is of type ‘char (*)[100]’
? The strlen in the above code does have argument 'want', which is a formal parameter of the function declared as (const char *). So where does this 'char (*)[100]' nonsense from? Does it try to in-line the routine somewhere, in a place where it is called with an actual parameter of the wrong type?
Re: Help request for debugging ICS
Maybe you can put it on github?
Then everybody can chime in to fix/improve things.
Then everybody can chime in to fix/improve things.
-
- Posts: 27808
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Help request for debugging ICS
There already is a version on github. By ddugovic. It is in my own on-line git repository too.
-
- Posts: 27808
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Help request for debugging ICS
Hmm, when I remove the & from &t->name, all the non-sensical warnings and their duplicats disappear. Indeed t->name is an array, which is an address, and I have no idea how you could take the address of an address. Seems to me that this should be an error, rather than a warning. It surely confused the compiler, making it completely lose track of the type of other, unrelated variables.
-
- Posts: 690
- Joined: Mon Apr 19, 2010 7:07 pm
- Location: Sweden
- Full name: Peter Osterlund
Re: Help request for debugging ICS
There is a good explanation here: http://stackoverflow.com/questions/2528 ... value-in-chgm wrote:Hmm, when I remove the & from &t->name, all the non-sensical warnings and their duplicats disappear. Indeed t->name is an array, which is an address, and I have no idea how you could take the address of an address. Seems to me that this should be an error, rather than a warning. It surely confused the compiler, making it completely lose track of the type of other, unrelated variables.