#4 x.c:8: warning: '__bounds_function_number_var.3' is used uni

open
nobody
None
5
2006-02-07
2006-02-07
No

I build a gcc-4.0.2 with the bounds checking patch.
I get the above error on the following minimized C file:
---- snip ----
#include <netinet/in.h>

#include <stdio.h>

static void handle_conn(void *args_p)
{
struct sockaddr_in *args = args_p;
printf("\nConnection from %u.\n",
ntohs(args->sin_port));
}

int main(void)
{
handle_conn(NULL);
return 0;
}
---- snip ----
The file stored in x.c and I use the follwoing command
line:

/opt/gcc-g++-bc-4.0.2/bin/gcc -Wall -Os
-fbounds-checking -c -o x.o x.c

Base is FC4 if that matters.

Discussion

  • Logged In: NO

    I'm running xgcc 4.0.2 under Cygwin. It compiled without error:
    bash-3.1$ /ecos-e/temp/COMP2009_2007/xgcc/xgcc-4.0.2/xgcc-4.0.2/gcc/xgcc -B/ecos-e/temp/COMP2009_2007/xgcc/xgcc-4.0.2/xgcc-4.0.2/gcc/ -g -fbounds-checking -Wall -Wextra -o x.exe x.c

    And generated the expected error at runtime:
    bash-3.1$ ./x.exe
    Bounds Checking GCC v gcc-4.0.2-3.2 Copyright (C) 1995 Richard W.M. Jones
    Bounds Checking comes with ABSOLUTELY NO WARRANTY. For details see file
    `COPYING' that should have come with the source to this program.
    Bounds Checking is free software, and you are welcome to redistribute it
    under certain conditions. See the file `COPYING' for details.
    For more information, set GCC_BOUNDS_OPTS to `-help'
    x.c:9:Bounds error: NULL or ILLEGAL pointer used in component reference.
    x.c:9: Pointer value: NULL
    6 [sig] x 3796 e:\temp\COMP2009_2007\xgcc\xgcc-4.0.2\xgcc-4.0.2\x.exe: *** fatal error - e:\temp\COMP2009_2007\xgcc\xgcc-4.0.2\xgcc-4.0.2\x.exe: *** called with threadlist_ix -1
    Hangup

    I don't see a problem.

    dan@ecs.soton.ac.uk

     
  • Logged In: YES
    user_id=1416411
    Originator: YES

    If I compile *without* the "-Os" I also get no compile time warning/error. "-O2" and "-O3" also trigger said warning/error.