Bug#757735: Need special debugging

2014-08-16 Thread Raphael Manfredi
Brian,

It's bad news to know that the program runs without optimizations but
fails when compiled with optimizations: that either means the program
is incorrectly doing something undefined, that leads to this different
behaviour, or that some of the optimizations performed by the compiler
are wrong.

Before accusing the compiler, I need to rule out any problem in the
code itself.

This is why I need you to run a test where the whole program is
optimized, and only the src/lib/xmalloc.c file is compiled without
optimizations.

Indeed, there is a possibility that the malloc() data structures are
corrupted outside, and of course the malloc() code will then discover
the inconsistency and fail, but that does not mean the bug is in the
malloc() code itself.

If you change the whole program to run without optimizations, you can
remove this accidental corruption source and then the program runs
normally, of course.

Not doing the test means I cannot investigate this bug further, since
I am unable to reproduce the failure here, even when compiling with -O3.

Cheers,
Raphael


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#757735: Need special debugging

2014-08-16 Thread brian m. carlson
tags 757735 + patch
kthxbye

On Sat, Aug 16, 2014 at 11:21:38AM +0200, Raphael Manfredi wrote:
 Brian,
 
 It's bad news to know that the program runs without optimizations but
 fails when compiled with optimizations: that either means the program
 is incorrectly doing something undefined, that leads to this different
 behaviour, or that some of the optimizations performed by the compiler
 are wrong.
 
 Before accusing the compiler, I need to rule out any problem in the
 code itself.
 
 This is why I need you to run a test where the whole program is
 optimized, and only the src/lib/xmalloc.c file is compiled without
 optimizations.

I did exactly that.  In fact, the attached patch makes it work just
fine.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
From ddb58565422e853ed5c1ea9ca859d13f03929df3 Mon Sep 17 00:00:00 2001
From: brian m. carlson sand...@crustytoothpaste.net
Date: Sat, 16 Aug 2014 15:08:34 +
Subject: [PATCH] Prevent crash in xmalloc.o.

xmalloc.o crashes with -O2, but works just fine with -O0.  Limit the
optimization on this file to avoid this problem.
---
 src/lib/Makefile.SH | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/lib/Makefile.SH b/src/lib/Makefile.SH
index 9aa424a..8eb0057 100644
--- a/src/lib/Makefile.SH
+++ b/src/lib/Makefile.SH
@@ -71,6 +71,10 @@ COMMON_LIBS =  $libs
 	\$(RM) \$@
 	\$(CC) -c \$(JCFLAGS) \$
 
+all:: .FORCE_DEPEND
+
+xmalloc.o: JCFLAGS = \$(CFLAGS) -O0 $pthread $ccflags $large
+
 !GROK!THIS!
 $spitshell Makefile '!NO!SUBS!'
 
-- 
2.1.0.rc1



signature.asc
Description: Digital signature