On 06/23/14 08:42, Paul Gortmaker wrote:
We see the following on a 32bit gcc installed on 64 bit host:

   Reading symbols from ./i586-pokymllib32-linux-gcc...done.
   (gdb) run
   Starting program: 
x86-pokymllib32-linux/lib32-gcc/4.9.0-r0/image/usr/bin/i586-pokymllib32-linux-gcc

   Program received signal SIGSEGV, Segmentation fault.
   0xf7e957e0 in free () from /lib/i386-linux-gnu/libc.so.6
   (gdb) bt
   #0  0xf7e957e0 in free () from /lib/i386-linux-gnu/libc.so.6
   #1  0x0804b73c in set_multilib_dir () at gcc-4.9.0/gcc/gcc.c:7827
   #2  main (argc=1, argv=0xffffd504) at gcc-4.9.0/gcc/gcc.c:6688
   (gdb)

The problem arises because the check on whether we are using
the internal string "." or an allocated one is reversed.
We should be calling free() when the string is not equal to
the internal "." string.

Signed-off-by: Paul Gortmaker <paul.gortma...@windriver.com>
---

[Found and fixed on gcc-4.9.0 but applies to git/master too]

  gcc/gcc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/gcc.c b/gcc/gcc.c
index 6870a840e1b7..a580975a7057 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -7822,7 +7822,7 @@ set_multilib_dir (void)
      }

    if (multilib_dir == NULL && multilib_os_dir != NULL
-      && strcmp (multilib_os_dir, ".") == 0)
+      && strcmp (multilib_os_dir, ".") != 0)
      {
        free (CONST_CAST (char *, multilib_os_dir));
        multilib_os_dir = NULL;

Thanks.  Installed on the trunk.
jeff

Reply via email to