From: trippels Date: Wed, 4 Mar 2015 17:28:56 +0000 (+0000) Subject: Fix PR65261 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=45e87ca9abf8edb4e36ab704e9fdae03ea2fe94c;p=thirdparty%2Fgcc.git 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 include/ PR target/65261 * ansidecl.h (ATTRIBUTE_NO_SANITIZE_UNDEFINED): New macro. libcpp/ PR target/65261 * lex.c (search_line_fast): Silence ubsan errors. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221190 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/include/ChangeLog b/include/ChangeLog index 689873b26b3b..bd072ae59b4d 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,8 @@ +2015-03-02 Markus Trippelsdorf + + PR target/65261 + * ansidecl.h (ATTRIBUTE_NO_SANITIZE_UNDEFINED): New macro. + 2015-02-19 Pedro Alves * floatformat.h [__cplusplus]: Wrap in extern "C". diff --git a/include/ansidecl.h b/include/ansidecl.h index 0fb23bba792d..04d75c33f747 100644 --- a/include/ansidecl.h +++ b/include/ansidecl.h @@ -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. */ diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 325f70609633..2d84835b7b72 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,8 @@ +2015-03-02 Markus Trippelsdorf + + PR target/65261 + * lex.c (search_line_fast): Silence ubsan errors. + 2015-02-03 PR preprocessor/64803 diff --git a/libcpp/lex.c b/libcpp/lex.c index 4638510166fa..0dc473711833 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -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) {