https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65909

            Bug ID: 65909
           Summary: check_v3_target_namedlocale blows up on targets that
                    don't support command-line arguments
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sandra at gcc dot gnu.org
  Target Milestone: ---

Created attachment 35410
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35410&action=edit
proposed patch

The test program written by check_v3_target_namedlocale in lib/libstdc++.exp
accesses the string at *(argv + 1) without first checking that argc >= 2.  Some
embedded targets don't support command-line arguments, so even though the
testsuite may always invoke the test program with the required number of
arguments, the program may not receive them.

I'm working with a new simulator provided by a customer that prints an error
message for accesses to unmapped memory and then continues execution instead of
terminating with an exception.  I ended up with a 2.4TB log file from running
the libstdc++ testsuite because of this problem.  :-(

I hacked up the attached patch as a quick fix; it has the effect of making it
think the requested locale is unsupported if the target has this problem.  A
better solution might be to write and compile a fresh program every time with a
hard-coded locale name to test for.  I guess it depends on whether you think
embedded targets that don't support programs with command-line arguments will
still be able to support named locales.

I ran into this in a local GCC 4.9.2 build but the code is the same on mainline
head.

Reply via email to