Upstream GCC's new pass '-fisolate-erroneous-paths' may introduce
traps at places where GCC has determined undefined behavior, e.g. when
passing a NULL pointer to a function that defines this argument as
__attribute__(__nonnull__(...)). In particular this applies to
uniquify_strings(), because it invokes qsort() with NULL when the
'strings' vector is empty. I hit this problem on s390x when trying to
execute "break main" on a C program.
gdb/
2013-11-12 Andreas Arnez <arnez@linux.vnet.ibm.com>
* objc-lang.c (uniquify_strings): Prevent invoking qsort with
NULL.
+2013-11-12 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * objc-lang.c (uniquify_strings): Prevent invoking qsort with
+ NULL.
+
2013-11-12 Doug Evans <dje@google.com>
Work around gold/15646.
const char *elem, *last = NULL;
int out;
+ /* If the vector is empty, there's nothing to do. This explicit
+ check is needed to avoid invoking qsort with NULL. */
+ if (VEC_empty (const_char_ptr, *strings))
+ return;
+
qsort (VEC_address (const_char_ptr, *strings),
VEC_length (const_char_ptr, *strings),
sizeof (const_char_ptr),