public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: bootstrap/7312: bootstrap failure due to invalid use of errno
@ 2003-05-08  4:26 Dara Hazeghi
  0 siblings, 0 replies; 4+ messages in thread
From: Dara Hazeghi @ 2003-05-08  4:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR bootstrap/7312; it has been noted by GNATS.

From: Dara Hazeghi <dhazeghi@yahoo.com>
To: gcc-gnats@gcc.gnu.org, bruno@clisp.org
Cc:  
Subject: Re: bootstrap/7312: bootstrap failure due to invalid use of errno
Date: Wed, 7 May 2003 21:24:02 -0700

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit- 
 trail&database=gcc&pr=7312
 
 Hello,
 
 could the submitter of this bug please confirm whether this problem  
 still occurs with a current version of gcc (ie 3.2.3). Thanks,
 
 Dara
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bootstrap/7312: bootstrap failure due to invalid use of errno
@ 2003-05-08 10:46 Bruno Haible
  0 siblings, 0 replies; 4+ messages in thread
From: Bruno Haible @ 2003-05-08 10:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR bootstrap/7312; it has been noted by GNATS.

From: Bruno Haible <bruno@clisp.org>
To: Dara Hazeghi <dhazeghi@yahoo.com>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: bootstrap/7312: bootstrap failure due to invalid use of errno
Date: Thu, 8 May 2003 12:43:58 +0200 (CEST)

 Dara Hazeghi writes:
 
 > could the submitter of this bug please confirm whether this problem  
 > still occurs with a current version of gcc (ie 3.2.3).
 
 The bug is still there, as you can see from a look at the gcc-3.2.3
 source code:
 
   _cpp_simplify_pathname (name);
   node = splay_tree_lookup (pfile->all_include_files, (splay_tree_key) name);
   if (node)
     free (name);
   else
     {
       file = xcnew (struct include_file);
       file->name = name;
       file->err_no = errno;
 
 xcnew calls malloc and therefore can clobber errno.
 
 Bruno


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bootstrap/7312: bootstrap failure due to invalid use of errno
@ 2003-05-08 10:44 giovannibajo
  0 siblings, 0 replies; 4+ messages in thread
From: giovannibajo @ 2003-05-08 10:44 UTC (permalink / raw)
  To: bruno, gcc-bugs, gcc-prs, nobody

Synopsis: bootstrap failure due to invalid use of errno

State-Changed-From-To: open->feedback
State-Changed-By: bajo
State-Changed-When: Thu May  8 10:43:58 2003
State-Changed-Why:
    See Dara's question.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7312


^ permalink raw reply	[flat|nested] 4+ messages in thread

* bootstrap/7312: bootstrap failure due to invalid use of errno
@ 2002-07-15  5:36 Bruno Haible
  0 siblings, 0 replies; 4+ messages in thread
From: Bruno Haible @ 2002-07-15  5:36 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-05-08 10:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-08  4:26 bootstrap/7312: bootstrap failure due to invalid use of errno Dara Hazeghi
  -- strict thread matches above, loose matches on Subject: below --
2003-05-08 10:46 Bruno Haible
2003-05-08 10:44 giovannibajo
2002-07-15  5:36 Bruno Haible

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).