all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Markus Trippelsdorf <markus@trippelsdorf.de>
To: Wolfgang Jenkner <wjenkner@inode.at>
Cc: 24065@debbugs.gnu.org
Subject: bug#24065: commit 09ece4d341a7 (Restore the calloc family) causes miscompile for gcc-5 and higher
Date: Mon, 25 Jul 2016 14:55:49 +0200	[thread overview]
Message-ID: <20160725125549.GC315@x4> (raw)
In-Reply-To: <57960850.TeswPyw0Vd9RvMtd%wjenkner@inode.at>

On 2016.07.25 at 14:38 +0200, Wolfgang Jenkner wrote:
> Markus Trippelsdorf <markus@trippelsdorf.de> wrote:
> 
> > commit 09ece4d341a7e07fab7be22868ebcadae8641c79
> > Author: Wolfgang Jenkner <wjenkner@inode.at>
> > Date:   Tue Feb 9 15:04:40 2016 -0800
> >
> >     Restore the calloc family.
> >
> > causes gcc-5 and higher to compile calloc to an endless loop.
> > -fno-builtin-malloc should be used to work around the problem.
> 
> This was the reason for the (compiler-independent) work-around
> discussed in
> 
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22085
> 
> and committed in
> 
> commit 4b1436b702d56eedd27a0777fc7232cdfb7ac4f6
> Author: Wolfgang Jenkner <wjenkner@inode.at>
> Date:   Sat Dec 26 12:12:02 2015 -0800
> 
>     Always define gmalloc etc. in src/gmalloc.c
>      
> The commit you cited shouldn't change that, I think.
> 
> In any case, that work-around seems to work for DragonflyBSD, which
> has gcc 5 as base compiler, and, for the time being (i.e., emacs-25
> branch), actually uses the malloc implemented in src/gmalloc, cf.
> 
> https://github.com/DragonFlyBSD/DPorts/tree/master/editors/emacs-devel
> 
> So, it would be useful to know on which system compilation fails.

This happens on a Gentoo system (glibc trunk, gcc-6 latest branch):

(gdb) run
Starting program: /var/tmp/portage/app-editors/emacs-24.5-r3/work/emacs-24.5/src/temacs --batch --load loadup bootstrap

Program received signal SIGSEGV, Segmentation fault.
0x00000000005cac25 in calloc (nmemb=<error reading variable: DWARF-2 expression error: Loop detected (257).>, size=size@entry=1) at gmalloc.c:1529
1529      result = malloc (bytes);
(gdb) bt
#0  0x00000000005cac25 in calloc (nmemb=<error reading variable: DWARF-2 expression error: Loop detected (257).>, size=size@entry=1) at gmalloc.c:1529
#1  0x00000000005cac2a in calloc (nmemb=<error reading variable: DWARF-2 expression error: Loop detected (257).>, size=size@entry=1) at gmalloc.c:1529
#2  0x00000000005cac2a in calloc (nmemb=<error reading variable: DWARF-2 expression error: Loop detected (257).>, size=size@entry=1) at gmalloc.c:1529
...

Adding -fno-builtin-malloc to CFLAGS fixes the issue for me.

-- 
Markus





  reply	other threads:[~2016-07-25 12:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-25  7:22 bug#24065: commit 09ece4d341a7 (Restore the calloc family) causes miscompile for gcc-5 and higher Markus Trippelsdorf
2016-07-25 12:38 ` Wolfgang Jenkner
2016-07-25 12:55   ` Markus Trippelsdorf [this message]
2016-07-25 13:27     ` Wolfgang Jenkner
2016-07-25 14:24       ` Markus Trippelsdorf
2016-07-25 15:48         ` Wolfgang Jenkner
2016-07-25 15:58           ` Markus Trippelsdorf
2016-07-26  7:08           ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160725125549.GC315@x4 \
    --to=markus@trippelsdorf.de \
    --cc=24065@debbugs.gnu.org \
    --cc=wjenkner@inode.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.