public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org> To: gcc-gnats@gcc.gnu.org Subject: bootstrap/7312: bootstrap failure due to invalid use of errno Date: Mon, 15 Jul 2002 05:36:00 -0000 [thread overview] Message-ID: <15666.49658.734634.850715@honolulu.ilog.fr> (raw) >Number: 7312 >Category: bootstrap >Synopsis: bootstrap failure due to invalid use of errno >Confidential: no >Severity: critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Mon Jul 15 05:36:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Bruno Haible >Release: 3.1 >Organization: GNU hackers >Environment: System: FreeBSD linuix.math.u-bordeaux.fr 4.0-RELEASE FreeBSD 4.0-RELEASE #0: Mon Mar 20 22:50:22 GMT 2000 root@monster.cdrom.com:/usr/src/sys/compile/GENERIC i386 host: i486-pc-freebsd-gnu build: i486-pc-freebsd-gnu target: i486-pc-freebsd-gnu configured with: /gnu/build/gcc-3.1/configure --enable-shared --disable-nls --prefix=/gnu/usr --with-local-prefix=/gnu/usr/local --with-as=/gnu/usr/bin/as --with-gnu-as --with-ld=/gnu/usr/bin/ld --with-gnu-ld --enable-languages=c --enable-threads i486-pc-freebsd-gnu >Description: Bootstrapping gcc leads to this error message during stage2: stage1/xgcc -Bstage1/ -B/gnu/tools/i486-pc-freebsd-gnu/bin/ -c -DIN_GCC -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long -DHAVE_CONFIG_H -I. -I. -I/gnu/build/gcc-3.1/gcc -I/gnu/build/gcc-3.1/gcc/. -I/gnu/build/gcc-3.1/gcc/config -I/gnu/build/gcc-3.1/gcc/../include /gnu/build/gcc-3.1/gcc/lists.c -o lists.o In file included from /gnu/build/gcc-3.1/gcc/system.h:157, from /gnu/build/gcc-3.1/gcc/lists.c:23: /gnu/tools/i486-pc-freebsd-gnu/include/unistd.h:500:27: bits/confname.h: No such file or directory The include file bits/confname.h exists under one of the -I directories. The problem is that find_or_create_entry() returns a splay_tree_node containing 'struct include_file' with err_no == ENOMEM, which then causes open_file() to behave as if the file did not exist. Now where does this ENOMEM come from? In find_or_create_entry(), right after the _cpp_simplify_pathname call, errno is 0, because the file exists. Then inside xcnew() malloc() is called, which clobbers ENOMEM. (At this point one of the malloc() strategies fails, brk() returns ENOMEM, and malloc() falls back on mmap().) The assumption that errno is not clobbered by successful calls to malloc() is invalid. >How-To-Repeat: On a FreeBSD system with glibc chroot environment, configure gcc as described above and run "make bootstrap". >Fix: Apply this patch. 2002-07-14 Bruno Haible <bruno@clisp.org> * cppfiles.c (find_or_create_entry): Fetch errno immediately after _cpp_simplify_pathname returns. *** gcc-3.1/gcc/cppfiles.c.bak Fri Jan 18 14:40:28 2002 --- gcc-3.1/gcc/cppfiles.c Sun Jul 14 01:16:19 2002 *************** *** 193,203 **** --- 193,205 ---- cpp_reader *pfile; const char *fname; { + int saved_errno; splay_tree_node node; struct include_file *file; char *name = xstrdup (fname); _cpp_simplify_pathname (name); + saved_errno = errno; node = splay_tree_lookup (pfile->all_include_files, (splay_tree_key) name); if (node) free (name); *************** *** 205,211 **** { file = xcnew (struct include_file); file->name = name; ! file->err_no = errno; node = splay_tree_insert (pfile->all_include_files, (splay_tree_key) file->name, (splay_tree_value) file); --- 207,213 ---- { file = xcnew (struct include_file); file->name = name; ! file->err_no = saved_errno; node = splay_tree_insert (pfile->all_include_files, (splay_tree_key) file->name, (splay_tree_value) file); >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2002-07-15 12:36 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-07-15 5:36 Bruno Haible [this message] 2003-05-08 4:26 Dara Hazeghi 2003-05-08 10:44 giovannibajo 2003-05-08 10:46 Bruno Haible
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=15666.49658.734634.850715@honolulu.ilog.fr \ --to=bruno@clisp.org \ --cc=gcc-gnats@gcc.gnu.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).