re PR target/65261 (bootstrap-ubsan ppc64le: gcc/libcpp/lex.c:552:30: runtime error: load of misaligned address 0x01002172dfc6 for type 'const uchar', which requires 16 byte alignment)

Fix PR65261

Running bootstrap-ubsan on ppc64le shows many instances of:

  libcpp/lex.c:552:30: runtime error: load of misaligned address
  0x01001f31d37a for type 'const uchar', which requires 16 byte alignment

But the unaligned vector loads are intended in this case, because they
are preferable to forced-alignment on POWER8. So just silence the ubsan
errors.

2015-03-02  Markus Trippelsdorf  <markus@trippelsdorf.de>

include/
	PR target/65261
	* ansidecl.h (ATTRIBUTE_NO_SANITIZE_UNDEFINED): New macro.

libcpp/
	PR target/65261
	* lex.c (search_line_fast): Silence ubsan errors.

From-SVN: r221190
This commit is contained in:
Markus Trippelsdorf 2015-03-04 17:28:56 +00:00 committed by Markus Trippelsdorf
parent b6584a72ac
commit 44d952440e
4 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2015-03-02 Markus Trippelsdorf <markus@trippelsdorf.de>
PR target/65261
* ansidecl.h (ATTRIBUTE_NO_SANITIZE_UNDEFINED): New macro.
2015-02-19 Pedro Alves <palves@redhat.com>
* floatformat.h [__cplusplus]: Wrap in extern "C".

View File

@ -276,6 +276,15 @@ So instead we use the macro below and test it against specific values. */
# endif /* GNUC >= 4.3 */
#endif /* ATTRIBUTE_HOT */
/* Attribute 'no_sanitize_undefined' was valid as of gcc 4.9. */
#ifndef ATTRIBUTE_NO_SANITIZE_UNDEFINED
# if (GCC_VERSION >= 4009)
# define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__ ((no_sanitize_undefined))
# else
# define ATTRIBUTE_NO_SANITIZE_UNDEFINED
# endif /* GNUC >= 4.9 */
#endif /* ATTRIBUTE_NO_SANITIZE_UNDEFINED */
/* We use __extension__ in some places to suppress -pedantic warnings
about GCC extensions. This feature didn't work properly before
gcc 2.8. */

View File

@ -1,3 +1,8 @@
2015-03-02 Markus Trippelsdorf <markus@trippelsdorf.de>
PR target/65261
* lex.c (search_line_fast): Silence ubsan errors.
2015-02-03 <dodji@redhat.com>
PR preprocessor/64803

View File

@ -519,6 +519,7 @@ init_vectorized_lexer (void)
and VSX unaligned loads (when VSX is available). This is otherwise
the same as the pre-GCC 5 version. */
ATTRIBUTE_NO_SANITIZE_UNDEFINED
static const uchar *
search_line_fast (const uchar *s, const uchar *end ATTRIBUTE_UNUSED)
{