[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#317233: gcc-4.0 regression, possibly powerpc-specific, causes segfault in compiled binary



Matthias Klose <doko@cs.tu-berlin.de> writes:

> Roger Leigh writes:
>> The fault occurs shortly after startup, calling parse_options()
>> (schroot/schroot.c).
>> 
>> If it would be useful, I can reduce it to a smaller test case, but the
>> code worked just fine with 3.3.
>
> yes, it would be useful. is this powerpc specific, or is seen on other
> archs as well?

I only have access to a powerpc sid system with the appropriate
build-deps, so I've only tested on powerpc.

I found the problem eventually.  It was fixed by the addition of a
single const.  I'm not sure why this was fatal:

@@ -61,7 +60,7 @@
   };

 /* Command-line options. */
-static GOptionEntry entries[] =
+static const GOptionEntry entries[] =
 {
   { "all", 'a', 0, G_OPTION_ARG_NONE, &opt.all, N_("Run command in all chroots"), NULL },
   { "chroot", 'c', 0, G_OPTION_ARG_STRING_ARRAY, &opt.chroots, N_("Use specified chroot"), "chroot" },


Before:
$ ./schroot --help
Usage:
  schroot [OPTION...] - run command or shell in a chroot

Segmentation fault


After:
$ ./schroot --help
Usage:
  schroot [OPTION...] - run command or shell in a chroot

Help Options:
  -?, --help                     Show help options

Application Options:
  -a, --all                      Run command in all chroots
  -c, --chroot=chroot            Use specified chroot
  -u, --user=user                Username (default current user)
  -l, --list                     List available chroots
  -i, --info                     Show information about chroot
  -p, --preserve-environment     Preserve user environment
  -q, --quiet                    Show less output
  -V, --version                  Print version information


I'm not sure if this is a gcc bug or not.  It's certainly a little
odd, and not at all obvious.


Regards,
Roger

-- 
Roger Leigh
                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                Debian GNU/Linux        http://www.debian.org/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.



Reply to: