GCC Bugzilla – Attachment 31514 Details for
Bug 59600
no_sanitize_address mishandled when function is inlined
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Compile and link with '-fsanitize=address -O2' and run to illustrate the bug
sanitize-bug.c (text/x-csrc), 1.14 KB, created by
Paul Eggert
on 2013-12-26 01:57:35 UTC
(
hide
)
Description:
Compile and link with '-fsanitize=address -O2' and run to illustrate the bug
Filename:
MIME Type:
Creator:
Paul Eggert
Created:
2013-12-26 01:57:35 UTC
Size:
1.14 KB
patch
obsolete
>/* Compile with 'gcc -fsanitize=address -O2' and run; the program > crashes because when 'mark_memory' is inlined, the deference is > incorrectly sanitized. Compiling with -DTHIS_WORKS_AROUND_THE_BUG > works around the bug. */ > >/* This is a simplified version of what Emacs does internally, > when marking its stack. */ > >static unsigned long sum; >static void *stack_base; > >/* A simple substitute for what Emacs actually does. */ >static void >mark_maybe_pointer (void *p) >{ > sum ^= (unsigned long) p; >} > >static void __attribute__ ((no_sanitize_address)) >#ifdef THIS_WORKS_AROUND_THE_BUG > __attribute__((noinline)) >#endif >mark_memory (void **start, void **end) >{ > void **pp; > > if (end < start) > { > void **tem = start; > start = end; > end = tem; > } > > for (pp = start; pp < end; pp++) > { > /* This is the dereference that we don't want sanitized. */ > void *p = *pp; > > mark_maybe_pointer (p); > } >} > >static void >mark_stack (void) >{ > void *end; > mark_memory (stack_base, &end); >} > >void >garbage_collect (void) >{ > mark_stack (); >} > >int >main (void) >{ > void *dummy; > stack_base = &dummy; > garbage_collect (); > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 59600
: 31514 |
31515
|
31516
|
31522