Bug #978
closedgcc version 4.8.4 crashes if use -O3 -g -flto with TRACEPOINT_LOGLEVEL()
0%
Description
gcc linker crashes when using -flto gcc (link time optimization), wondering if you can provide a work around. The cause seems to be the TRACEPOINT_LOGLEVEL() generated 2 lines.
- uname -a
... 3.19.0-30-generic #34~14.04.1-Ubuntu SMP Fri Oct 2 22:09:39 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
gcc version:
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)
Here is a simple sample program that crashes the gcc linker:
tst.c:
[
#include "tst_trace.h"
main(void)
{
int i;
for (i = 0; i < 10; i++)
tracepoint(tst, tst_main);
}
]
tst_trace.c:
[
#define TRACEPOINT_CREATE_PROBES
#define TRACEPOINT_DEFINE
#include "./tst_trace.h"
]
tst_trace.h:
[
#undef TRACEPOINT_PROVIDER
#define TRACEPOINT_PROVIDER tst
#undef TRACEPOINT_INCLUDE
#define TRACEPOINT_INCLUDE "./tst_trace.h"
#if !defined(_TST_TRACE_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
#define _TST_TRACE_H
#include <lttng/tracepoint.h>
TRACEPOINT_EVENT(
tst, tst_main, TP_ARGS(), TP_FIELDS()
)
TRACEPOINT_LOGLEVEL(tst, tst_main, TRACE_DEBUG_UNIT)
#endif /* _TST_TRACE_H */
#include <lttng/tracepoint-event.h>
]
these compile & link command options:
[
cc -O3 -g -flto -I. -c -o tst.o tst.c
cc -O3 -g -flto -I. -c -o tst_trace.o tst_trace.c
g++ -O3 -g -flto tst_trace.o tst.o -o tst -l lttng-ust -l dl
]
crash the linker:
[
lto1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
]
thanks, John
Updated by Mathieu Desnoyers almost 9 years ago
- Status changed from New to Invalid
It works fine here with gcc version 4.9.2 (Debian 4.9.2-10).
Works fine with gcc-4.7 (Debian 4.7.4-3) 4.7.4 too.
It indeed crashes the linker with gcc-4.8 (Debian 4.8.4-1) 4.8.4 here.
It is clearly an issue with gcc, you should report it to them, or upgrade/downgrade your compiler.
Closing this issue, as the cause is not lttng-ust, but a bug in the compiler.