[Bug c/37154] New: static inline function problem
i am getting SIGSEGV while starting two glib2 applications. please take a look at glib2/gogject/gsignal.c code: - 2280 gboolean continue_emission; 2281 2282 if (!accumulator) 2283return TRUE; 2284 2285 continue_emission = accumulator->func (ihint, return_accu, handler_return, accumulator->data); 2286 g_value_reset (handler_return); -- gdb claims that problem is at line 2285, variable "accumulator" is 0x0, which should not happen due to lines 228{2,3}. the function is declared as 'static inline'. removing inline keyword and recompilation helps. commmand used to compile gsignal.c file: ppc-pld-linux-gcc -DHAVE_CONFIG_H -I. -I.. -DG_LOG_DOMAIN=\"GLib-GObject\" -I.. -I../glib -I.. -DG_DISABLE_CAST_CHECKS -DG_DISABLE_DEPRECATED -DGOBJECT_COMPILATION -DG_DISABLE_CONST_RETURNS -D_FORTIFY_SOURCE=2 -pthread -O2 -fno-strict-aliasing -fwrapv -fsigned-char -gdwarf-2 -g2 -Wall -MT gsignal.lo -MD -MP -MF .deps/gsignal.Tpo -c gsignal.c -fPIC -DPIC -o .libs/gsignal.o - -- Summary: static inline function problem Product: gcc Version: 4.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wrobell at pld-linux dot org GCC build triplet: ppc-pld-linux-gcc GCC host triplet: ppc-pld-linux-gcc GCC target triplet: ppc-pld-linux-gcc http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37154
[Bug c/37154] static inline function problem
--- Comment #1 from wrobell at pld-linux dot org 2008-08-18 21:05 --- Created an attachment (id=16088) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16088&action=view) gsignal.i file -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37154
[Bug c/37154] static inline function problem
--- Comment #2 from wrobell at pld-linux dot org 2008-08-18 21:05 --- Created an attachment (id=16089) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16089&action=view) gsignal.s file created by gcc before 'inline' keyword removal -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37154
[Bug c/37154] static inline function problem
--- Comment #3 from wrobell at pld-linux dot org 2008-08-18 21:06 --- Created an attachment (id=16090) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16090&action=view) gsignal.s file after 'inline' keyword removal -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37154
[Bug middle-end/37154] static inline function problem
--- Comment #5 from wrobell at pld-linux dot org 2008-08-18 22:40 --- (In reply to comment #4) > >gdb claims that problem is at line 2285, variable "accumulator" is 0x0, > > well with optimization, debugging info is not always fully correct. > i've changed function declaration again to 'static inline' and inserted printf('acc %d\n', accumulator); just before line 2285. i've got 'acc 0'. so it is really 0x0 and the condition at line 2282 is not evaluated properly (or was optimized out/whatever :) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37154