Hi.
With LTO and -fsanitize we end up with a static ctor
(_GLOBAL__sub_I_00099_0_main) that has no source location.
With that stack usage will print '(artificial)' as a location
of the function.
Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
Ready to be installed?
Thanks,
Martin
gcc/ChangeLog:
2019-05-16 Martin Liska <mli...@suse.cz>
PR driver/90495
* toplev.c (output_stack_usage): With LTO and sanitizer it
happens that a global ctor (_GLOBAL__sub_I_00099_0_main)
has no file location.
---
gcc/toplev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 397a164068d..a27cdc4325d 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1019,7 +1019,7 @@ output_stack_usage (void)
fprintf (stack_usage_file,
"%s:%d:%d:%s\t" HOST_WIDE_INT_PRINT_DEC"\t%s\n",
- lbasename (loc.file),
+ loc.file == NULL ? "(artificial)" : lbasename (loc.file),
loc.line,
loc.column,
name,