[armel] segfaults in make check pass when built with optimization

Bug #758082 reported by Jani Monoses
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Fix Released
High
Unassigned
augeas (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

FTBFS on armel
https://launchpadlibrarian.net/68239668/buildlog_ubuntu-natty-armel.augeas_0.8.0-0ubuntu3_FAILEDTOBUILD.txt.gz
not apparent from the log but the failing of test-interpreter.sh is due to a core dump.

Starting program: /home/jani/work/ftbfs/aug/augeas-0.8.0/src/.libs/lt-augparse --nostdinc -I . fail_let_no_exp.aug

Program received signal SIGSEGV, Segmentation fault.
strlen () at ../ports/sysdeps/arm/strlen.S:29
29 ../ports/sysdeps/arm/strlen.S: No such file or directory.
 in ../ports/sysdeps/arm/strlen.S
(gdb) bt
#0 strlen () at ../ports/sysdeps/arm/strlen.S:29
#1 0x4016c050 in _IO_vfprintf_internal (s=<value optimized out>, format=<value optimized out>, ap=<value optimized out>) at vfprintf.c:1620
#2 0x401d7b66 in __vasprintf_chk (result_ptr=0xbee5097c, flags=1, format=0x400d961c "%s", args=...) at vasprintf_chk.c:68
#3 0x400bfad6 in vasprintf (info=<value optimized out>, code=<value optimized out>, format=0x400d961c "%s", ap=...) at /usr/include/bits/stdio2.h:199
#4 format_error (info=<value optimized out>, code=<value optimized out>, format=0x400d961c "%s", ap=...) at syntax.c:96
#5 0x400bfd98 in syntax_error (info=0x1, format=0x400d961c "%s") at syntax.c:124
#6 0x400c3e96 in augl_error (locp=<value optimized out>, term=<value optimized out>, scanner=<value optimized out>, s=0x400d7abc "syntax error") at parser.y:628
#7 0x400c54f8 in augl_parse_file (aug=0x1ef1878, name=<value optimized out>, term=0xbee50a64) at parser.y:362
#8 0x400c153a in load_module_file (aug=0x1ef1878, filename=0xbee50ddb "fail_let_no_exp.aug") at syntax.c:1951
#9 0x400bbf0a in __aug_load_module_file (aug=0x1ef1878, filename=0xbee50ddb "fail_let_no_exp.aug") at augeas.c:1447
#10 0x00008b04 in main (argc=<value optimized out>, argv=0xbee50c84) at augparse.c:131

Related branches

Jani Monoses (jani)
summary: - segfaults in make check pass when built with optimization
+ [armel] segfaults in make check pass when built with optimization
tags: added: arm-porting-queue
Revision history for this message
Ira Rosen (irar) wrote : AUTO: Ira Rosen is out of the office. (returning 17/04/2011)

I am out of the office until 17/04/2011.

Note: This is an automated response to your message "[Bug 758082] [NEW]
[armel] segfaults in make check pass when built with optimization" sent on
12/4/11 0:03:12.

This is the only notification you will receive while this person is away.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package augeas - 0.8.0-0ubuntu4

---------------
augeas (0.8.0-0ubuntu4) natty; urgency=low

  * debian/rules: Work around segfault in make check by building with -O0 on armel.
    Fixes armel FTBFS (LP: #758082)
 -- Jani Monoses <email address hidden> Tue, 12 Apr 2011 00:04:20 +0300

Changed in augeas (Ubuntu):
status: New → Fix Released
Revision history for this message
Dr. David Alan Gilbert (davidgil-uk) wrote :

Just poking about, it looks like just recompiling syntax.c with -O0 gets it working.
(indeed compiling it with -O1 makes it fail more tests that -O2).

It's a whole chain of passing va_args down throuhg about 5 different levels of printf type thing.

Dave

Revision history for this message
Dr. David Alan Gilbert (davidgil-uk) wrote :

This is from a -O1 of syntax.c - note how it stamps on r2 as a temp which is the 1st variadic argument before it gets to stack the original.

        .global syntax_error <<<<< void syntax_error(struct info *info, const char *format, ...) {
        .thumb
        .thumb_func
        .type syntax_error, %function
syntax_error:
        .fnstart
.LFB100:
        .loc 1 116 0
        .cfi_startproc
        @ args = 4, pretend = 12, frame = 8
        @ frame_needed = 0, uses_anonymous_args = 1
        .loc 1 120 0
        ldr r3, [r0, #0]
        ldr r3, [r3, #0]
        subs r2, r3, #6 !!!!!
        it ne
        movne r2, #1
        cmp r3, #0
        ite eq
        moveq r3, #0
        andne r3, r2, #1
        cbnz r3, .L153
        .loc 1 116 0
        push {r1, r2, r3}
        .save {r1, r2, r3}

Revision history for this message
Jani Monoses (jani) wrote :

the effect look similar to the one affecting telepathy-glib

https://bugs.launchpad.net/ubuntu/+source/telepathy-glib/+bug/736081

Revision history for this message
Dr. David Alan Gilbert (davidgil-uk) wrote :

Thanks to Ramana for suggesting -fno-shrink-wrap which does indeed fix it.
(L153 is an early exit).

Dave

Revision history for this message
Dr. David Alan Gilbert (davidgil-uk) wrote :

This test case fails with -O1 but works with -fno-shrink-wrap and seems to be the same failure pattern.

Michael Hope (michaelh1)
tags: added: shrinkwrap
Changed in gcc-linaro:
status: New → Triaged
importance: Undecided → High
Revision history for this message
Michael Hope (michaelh1) wrote :

lp:~rsandifo/gcc-linaro/lp-758082 fixes this but the code generated is poor:

foo:
 push {r1, r2, r3}
 ldr r3, [r0, #0]
 push {lr}
 sub sp, sp, #8
 ldr r3, [r3, #8]
 subs r2, r3, #6
 it ne
 movne r2, #1
 cmp r3, #8
 ite eq
 moveq r3, #0
 andne r3, r2, #1
 cbnz r3, .L1
 movw r2, #:lower16:stdout
 add r3, sp, #16
 movt r2, #:upper16:stdout
 ldr r1, [sp, #12]
 ldr r0, [r2, #0]
 mov r2, r3
 str r3, [sp, #4]
 bl vfprintf
.L1:
 add sp, sp, #8
 pop {lr}
 add sp, sp, #12
 bx lr

r1 doesn't need to be saved. Ignoring hazards, r0 could be used instead of r3. The epilogue is poor due to the two adds. lr could be pushed with the initial push.

Revision history for this message
Michael Hope (michaelh1) wrote :

Split the performance into LP: #767986

Changed in gcc-linaro:
milestone: none → 4.5-2011.04-0
Michael Hope (michaelh1)
Changed in gcc-linaro:
status: Triaged → Fix Committed
Michael Hope (michaelh1)
Changed in gcc-linaro:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.