[Bug libmudflap/56390] New: [setjmp/longjmp] Mudflap false violation

2013-02-19 Thread m.labanowicz at gmail dot com


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 

02: #include 

03: #include 

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






[Bug libmudflap/56105] New: Simple ANSI C 89 code -> Mudflap false violation

2013-01-25 Thread m.labanowicz at gmail dot com


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



 Bug #: 56105

   Summary: Simple ANSI C 89 code -> 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





$ gcc --version

gcc (Ubuntu/Linaro 4.7.2-11precise2) 4.7.2



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

01: long bar_fun(unsigned idx) {

02:   long bar_cfg [][2] = {

03: {9, 0}, {8, 1}, {7, 2}, {6, 3},

04: {5, 4}, {4, 5}, {3, 6}, {2, 7},

05: {0, 9}

06:   };

07:   return (idx < (unsigned)(sizeof(bar_cfg) / sizeof(*bar_cfg)))

08: ? bar_cfg[idx][1] : -1;

09: }



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

01: #include  /* printf */

02: #include  /* EXIT_SUCCESS */

03: long bar_fun(unsigned idx);

04: static long foo_fun(unsigned idx) {

05:   long const TOSTEP [][2] = {

06: {0, 9}, {1, 8}, {2, 7}, {3, 6},

07: {4, 5}, {5, 4}, {6, 3}, {7, 2},

08: {8, 1}, {9, 0}

09:   };

10:   return (idx < (unsigned)(sizeof(TOSTEP) / sizeof(*TOSTEP)))

11: ? (int)(TOSTEP[idx][1]) : -1;

12: }

13: int main(void) {

14:   printf("foo_fun = %ld\r\n", foo_fun(4));

15:   printf("bar_fun = %ld\r\n", bar_fun(4));

16:   return EXIT_SUCCESS;

17: }



$ gcc -ansi -pedantic -Wall -W -Werror -fmudflap bar.c main.c -lmudflap -o

a.out



$ echo ":${MUDFLAP_OPTIONS}:"

::



$ ./a.out

***

mudflap violation 1 (register): time=1359114674.510460 ptr=0xbfd664d0 size=80

pc=0xb76c3b4e

  /usr/lib/i386-linux-gnu/libmudflap.so.0(__mf_register+0x3e) [0xb76c3b4e]

  ./a.out() [0x8048ab9]

  ./a.out(__libc_csu_init+0x52) [0x8048b62]

Nearby object 1: checked region begins 8B before and ends 71B into

mudflap object 0x89081e8: name=`constant'

bounds=[0xbfd664d8,0xbfd6651f] size=72 area=static check=0r/0w liveness=0

alloc time=1359114674.510456 pc=0xb76c3b4e

number of nearby objects: 1

foo_fun = 5

bar_fun = 4



-[END]---