http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56390



             Bug #: 56390

           Summary: [setjmp/longjmp] Mudflap false violation

    Classification: Unclassified

           Product: gcc

           Version: 4.7.2

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: libmudflap

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: m.labanow...@gmail.com





Following correct ANSIC code generates Mudflap Violation:



$ gawk '{printf("%02u: %s\n", NR, $0);}' main.c

01: #include <setjmp.h>

02: #include <string.h>

03: #include <stdlib.h>

04: int main(void) {

05:   volatile int var = 56;

06:   jmp_buf jmp;

07:    if (0 == setjmp(jmp)) {

08:      char bar [15];

09:      memset(bar, 0, sizeof(bar));

10:      var = 45;

11:      longjmp(jmp, 1);

12:    }

13:    else {

14:      char foo [11];

15:      memset(foo, var, sizeof(foo));

16:    }

17:    return EXIT_SUCCESS;

18: }



$ gcc -fmudflap main.c -lmudflap -o a.out



$ ./a.out

*******

mudflap violation 1 (register): time=1361265264.662245 ptr=0x7fff631e5370

size=11

pc=0x7f0823f195f1

      /usr/lib/x86_64-linux-gnu/libmudflap.so.0(__mf_register+0x41)

[0x7f0823f195f1]

      ./a.out(main+0xc0) [0x400a9c]

      /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f0823b7276d]

Nearby object 1: checked region begins 0B into and ends 10B into

mudflap object 0x908ba0: name=`main.c:8:11 (main) bar'

bounds=[0x7fff631e5370,0x7fff631e537e] size=15 area=stack check=0r/1w

liveness=1

alloc time=1361265264.662235 pc=0x7f0823f195f1

number of nearby objects: 1

*******

mudflap violation 2 (unregister): time=1361265264.662597 ptr=0x7fff631e5370

size=11

pc=0x7f0823f19196

      /usr/lib/x86_64-linux-gnu/libmudflap.so.0(__mf_unregister+0x36)

[0x7f0823f19196]

      ./a.out(main+0xef) [0x400acb]

      /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f0823b7276d]

Nearby object 1: checked region begins 0B into and ends 10B into

mudflap object 0x908ba0: name=`main.c:8:11 (main) bar'

number of nearby objects: 1



----

Reply via email to