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 +0000
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

Attachment: signature.asc
Description: Digital signature

Reply via email to