[PATCH] Fix LOOP_REQUIRES_VERSIONING_* macros (PR c/61271)

2014-08-25 Thread Marek Polacek
for LOOP_REQUIRES_VERSIONING_FOR_ALIAS. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2014-08-25 Marek Polacek pola...@redhat.com PR c/61271 * tree-vectorizer.h (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT, LOOP_REQUIRES_VERSIONING_FOR_ALIAS): Wrap in parens. diff --git gcc/tree-vectorizer.h

[PATCH] Fix UB in expmed.c (PR middle-end/61903)

2014-08-25 Thread Marek Polacek
/regtested on x86_64-linux, ok for trunk? 2014-08-25 Marek Polacek pola...@redhat.com PR middle-end/61903 * expmed.c (store_fixed_bit_field_1): Shift UHWI 1 instead of HWI 1. Change the type of V to unsigned HOST_WIDE_INT. diff --git gcc/expmed.c gcc/expmed.c index

Re: [C++ PATCH] Allow void type as a literal type in C++14

2014-11-28 Thread Marek Polacek
Ping. On Fri, Nov 21, 2014 at 06:55:51PM +0100, Marek Polacek wrote: I noticed that C++14 [basic.types] says that a type is a literal type if it is: void, [...]. Yet our literal_type_p doesn't consider void type as a literal type. The following is an attempt to fix that along

[PATCH] Fix ubsan ICE in the shift instrumentation

2014-11-28 Thread Marek Polacek
I forgot to adjust the C++ part of the shift instrumentation as well. Bootstrapped/regtested on ppc64-linux, ok for trunk? 2014-11-28 Marek Polacek pola...@redhat.com * c-ubsan.c (ubsan_instrument_shift): Use op1_utype for MINUS_EXPR instead of unsigned_type_node. * c

Re: [PATCH] Fix ubsan and C++14 constexpr ICEs (PR sanitizer/63956)

2014-12-01 Thread Marek Polacek
On Sun, Nov 30, 2014 at 11:00:12PM -0500, Jason Merrill wrote: On 11/27/2014 08:57 AM, Marek Polacek wrote: -/* { dg-error is not a constant expression { target c++ } 12 } */ +/* { dg-error { xfail { *-*-* } } 11 } */ Please keep the expected message. Done in the below. 2014-12-01

Re: [C++ PATCH] Detect UB in shifts in constexpr functions

2014-12-02 Thread Marek Polacek
-02 Marek Polacek pola...@redhat.com * constexpr.c (cxx_eval_check_shift_p): New function. (cxx_eval_binary_expression): Call it. * g++.dg/cpp0x/constexpr-shift1.C: New test. * g++.dg/cpp1y/constexpr-shift1.C: New test. * g++.dg/ubsan/pr63956.C: Add dg

Re: [C++ PATCH] Detect UB in shifts in constexpr functions

2014-12-02 Thread Marek Polacek
-02 Marek Polacek pola...@redhat.com * constexpr.c (cxx_eval_check_shift_p): New function. (cxx_eval_binary_expression): Call it. Set NON_CONSTANT_P if it returns true. * g++.dg/cpp0x/constexpr-shift1.C: New test. * g++.dg/cpp1y/constexpr-shift1.C: New

[PATCH] Fix some 28_regex/ fallout

2014-12-03 Thread Marek Polacek
This fixes some testsuite fallout in 28_regex/. The problem was that with -m32 we were triggering UB in a shift. Fixed by multiplying the RHS of the shift-expression by 0 if we are not going to use the cache. Regtested/bootstrapped on ppc64-linux, ok for trunk? 2014-12-03 Marek Polacek pola

Re: [PATCH] Fix some 28_regex/ fallout

2014-12-03 Thread Marek Polacek
On Wed, Dec 03, 2014 at 04:03:37PM +, Jonathan Wakely wrote: On 03/12/14 16:47 +0100, Marek Polacek wrote: @@ -417,7 +417,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef typename std::is_same_CharT, char::type _UseCache; static constexpr size_t - _S_cache_size() { return

Re: [C++ PATCH] Detect UB in shifts in constexpr functions

2014-12-03 Thread Marek Polacek
On Wed, Dec 03, 2014 at 02:45:50PM +0100, Andreas Schwab wrote: Marek Polacek pola...@redhat.com writes: * constexpr.c (cxx_eval_check_shift_p): New function. (cxx_eval_binary_expression): Call it. Set NON_CONSTANT_P if it returns true. * g++.dg/cpp0x/constexpr-shift1

[PATCH] Careful with BIT_NOT_EXPR folding (PR middle-end/56917)

2014-12-04 Thread Marek Polacek
on ppc64-linux, ok for trunk? 2014-12-04 Marek Polacek pola...@redhat.com PR middle-end/56917 * fold-const.c (fold_unary_loc): Don't introduce undefined behavior when transforming ~ (A - 1) or ~ (A + -1) to -A. * c-c++-common/ubsan/pr56917.c: New test. diff

Re: [patch c++]: Fix PR/64100 'A static assert using the the current class in a noexcept test leads to a segfault'

2014-12-04 Thread Marek Polacek
On Thu, Dec 04, 2014 at 04:00:34PM +0100, Kai Tietz wrote: Hi, The issue is that lookup_destructor calls adjust_result_of_qualified_name_lookup with an NULL_TREE decl (returned by lookup_member). So error-message is missing. As already discussed in bug-tracker: ChangeLog

Re: [patch c++]: Fix PR/64127 ICE on invalid: tree check: exprected identifier_node, have template_id_expr in cp_parser_diagnose_invalid_type_name

2014-12-04 Thread Marek Polacek
On Thu, Dec 04, 2014 at 04:12:02PM +0100, Kai Tietz wrote: Hi, this patch fixes an ICE happening on invalid code for c++11. It is reasoned by accessing blindly identifier without checking that it is a declaration. ChangeLog 2014-12-04 Kai Tietz kti...@redhat.com PR c++/64127

Re: [PATCH] Careful with BIT_NOT_EXPR folding (PR middle-end/56917)

2014-12-04 Thread Marek Polacek
On Thu, Dec 04, 2014 at 05:34:35PM +0100, Richard Biener wrote: On December 4, 2014 4:45:25 PM CET, Marek Polacek pola...@redhat.com wrote: The PR shows a case in which fold introduces undefined behavior in a valid program, because what it does here is -(long int) (ul + ULONG_MAX) - 1

Re: [patch c++]: Fix PR c++/64106 ICE on valid code

2014-12-04 Thread Marek Polacek
On Thu, Dec 04, 2014 at 02:37:54PM -0500, Jason Merrill wrote: My patch from yesterday fixed this bug. PR c++/64080 * constexpr.c (cxx_eval_store_expression): Handle non-decl store targets. I don't see such a patch neither on ML nor in git. Marek

[PATCH] Don't promote RHS of shift-expr if it's integer_type (PR tree-optimization/64183)

2014-12-05 Thread Marek Polacek
My recent change to shift operand promotion caused a regression in loop unrolling. Fixed as Richi suggested in the PR audit trail. Bootstrapped/regtested on ppc64-linux and x86_64-linux, ok for trunk? 2014-12-05 Marek Polacek pola...@redhat.com PR tree-optimization/64183 * c

Re: [PATCH] Don't promote RHS of shift-expr if it's integer_type (PR tree-optimization/64183)

2014-12-05 Thread Marek Polacek
On Fri, Dec 05, 2014 at 12:08:02PM +0100, Jakub Jelinek wrote: On Fri, Dec 05, 2014 at 11:27:50AM +0100, Marek Polacek wrote: My recent change to shift operand promotion caused a regression in loop unrolling. Fixed as Richi suggested in the PR audit trail. Bootstrapped/regtested

[PATCH] TYPE_OVERFLOW_* cleanup

2014-12-09 Thread Marek Polacek
straightforward, but I had to tweak a few places wrt vector_types (where I've used VECTOR_INTEGER_TYPE_P) to not to regress folding - and I'm afraid I missed places that aren't tested in our testsuite :/. Bootstrapped/regtested on ppc64-linux and x86_64-linux. 2014-12-09 Marek Polacek pola...@redhat.com

[PATCH] Fix a typo in range_entry_cmp (PR tree-optimization/61686)

2014-12-09 Thread Marek Polacek
-12-10 Marek Polacek pola...@redhat.com PR tree-optimization/61686 * tree-ssa-reassoc.c (range_entry_cmp): Use q-high instead of p-high. diff --git gcc/tree-ssa-reassoc.c gcc/tree-ssa-reassoc.c index 68a67b6..00bca8b 100644 --- gcc/tree-ssa-reassoc.c +++ gcc/tree-ssa

Re: [PATCH] Fix a typo in range_entry_cmp (PR tree-optimization/61686)

2014-12-10 Thread Marek Polacek
On Wed, Dec 10, 2014 at 08:59:09AM +0100, Jakub Jelinek wrote: On Wed, Dec 10, 2014 at 07:57:46AM +0100, Marek Polacek wrote: I don't really know this code, but this typo looks obvious enough. Using if (p-high != NULL_TREE) ... else if (p-high != NULL_TREE) couldn't be possibly desired, so

Re: [PATCH] TYPE_OVERFLOW_* cleanup

2014-12-10 Thread Marek Polacek
On Tue, Dec 09, 2014 at 08:26:56PM +0100, Marc Glisse wrote: @@ -426,7 +426,8 @@ negate_expr_p (tree t) case VECTOR_CST: { -if (FLOAT_TYPE_P (TREE_TYPE (type)) || TYPE_OVERFLOW_WRAPS (type)) +if (FLOAT_TYPE_P (TREE_TYPE (type)) +|| (INTEGRAL_TYPE_P (type)

Re: [PATCH] TYPE_OVERFLOW_* cleanup

2014-12-10 Thread Marek Polacek
On Wed, Dec 10, 2014 at 09:42:58AM +0100, Richard Biener wrote: On Tue, 9 Dec 2014, Marek Polacek wrote: The issue here is that TYPE_OVERFLOW_TRAPS, TYPE_OVERFLOW_UNDEFINED, and TYPE_OVERFLOW_WRAPS macros work on integral types only, yet we pass e.g. pointer_type/real_type to them

Re: [PATCH] TYPE_OVERFLOW_* cleanup

2014-12-11 Thread Marek Polacek
in the following, thanks for looking into this! Bootstrapped/regtested on x86_64-linux, ok for trunk? 2014-12-11 Marek Polacek pola...@redhat.com * fold-const.c (fold_negate_expr): Add ANY_INTEGRAL_TYPE_P check. (extract_muldiv_1): Likewise. (maybe_canonicalize_comparison_1

[PATCH] Fix TYPE_OVERFLOW_* cleanup fallout

2014-12-12 Thread Marek Polacek
On ARM we ICE on fixed-point-exec.c testcase because TYPE_OVERFLOW_WRAPS was missing the ANY_INTEGRAL_TYPE_P check. Bootstrapped/regtested on x86_64-linux and ppc64-linux, ok for trunk? 2014-12-12 Marek Polacek pola...@redhat.com PR middle-end/64274 * fold-const.c

[PATCH] More TYPE_OVERFLOW_* fallout (PR middle-end/64292)

2014-12-15 Thread Marek Polacek
m68k revealed another missing check before TYPE_OVERFLOW_WRAPS. I think we should use INTEGRAL_TYPE_P, and not ANY_INTEGRAL_TYPE_P because the switch handles VECTOR_CST and COMPLEX_CST. Bootstrapped/regtested on x86_64-linux and ppc64-linux, ok for trunk? 2014-12-15 Marek Polacek pola

[PATCH] Add (1 A) 1) folding (PR middle-end/64309)

2014-12-16 Thread Marek Polacek
regress ubsan sanitization, but luckily that is not the case and the shift diagnostics seems to be intact. It triggers several times during the bootstrap. Bootstrapped/regtested on x86_64-linux + ppc64-linux, ok for trunk? 2014-12-16 Marek Polacek pola...@redhat.com PR middle-end/64309

Re: [PATCH] Add (1 A) 1) folding (PR middle-end/64309)

2014-12-16 Thread Marek Polacek
- we don't allow complex operands for neither shift, nor bit and. So I left the integer_onep in there. Thanks. 2014-12-16 Marek Polacek pola...@redhat.com PR middle-end/64309 * match.pd: Add ((1 A) 1) != 0 - A == 0 and ((1 A) 1) == 0 - A != 0. * gcc.dg

[PATCH] Add (x ~m) | (y m) folding (PR middle-end/63568)

2014-12-17 Thread Marek Polacek
like andn instruction (e.g. BMI1 on Intel), but that is something for expand/combine. Not sure if some single-use restriction applies here or not. Bootstrapped/regtested on x86_64-linux and ppc64-linux, ok for trunk? 2014-12-17 Marek Polacek pola...@redhat.com PR middle-end/63568

Re: [PATCH] Add (x ~m) | (y m) folding (PR middle-end/63568)

2014-12-17 Thread Marek Polacek
On Wed, Dec 17, 2014 at 10:12:06AM +0100, Richard Biener wrote: On Wed, 17 Dec 2014, Jakub Jelinek wrote: On Wed, Dec 17, 2014 at 09:46:44AM +0100, Marek Polacek wrote: This adds a transformation of (x ~m) | (y m), which (on GIMPLE) has 4 ops to x ^ ((x ^ y) m) that has 3 ops

Re: [C PATCH] Fix ICE with invalid function call (PR c/64778)

2015-01-26 Thread Marek Polacek
On Mon, Jan 26, 2015 at 10:10:56PM +0100, Jakub Jelinek wrote: Hi! On the following testcase we ICE, because we end up with a CALL_EXPR with error_mark_node argument and gimplification can't cope with that. Normally, if one or more arguments are error_mark_node we return -1 and drop the

Re: #pragma GCC unroll support

2015-01-30 Thread Marek Polacek
On Fri, Jan 30, 2015 at 08:27:06AM -0800, Mike Stump wrote: +static bool +c_parse_pragma_ivdep (c_parser *parser) +{ + c_parser_consume_pragma (parser); + c_parser_skip_to_pragma_eol (parser); + return true; +} + +static unsigned short +c_parser_pragma_unroll (c_parser *parser)

[wwwdocs] Add porting_to.html for GCC 5 (again)

2015-01-14 Thread Marek Polacek
A few months ago I posted the porting to document for GCC 5. But I never got around to commit it, so here it is again, this time with feewing. I fixed description of GNU89 extern inline, added some more snippets, and mentioned -Wc9?-c??-compat warnings. I plan to commit this tomorrow. ---

[4.8] Backport PR61553

2015-01-20 Thread Marek Polacek
I'd like to backport this patch from trunk to 4.9 so as to fix PR63751. It's safe and has been on trunk for several months. Bootstrapped/regtested on x86_64-linux, ok? 2015-01-20 Marek Polacek pola...@redhat.com Backport from mainline 2014-06-23 Marek Polacek pola

Re: [4.8] Backport PR61553

2015-01-20 Thread Marek Polacek
On Tue, Jan 20, 2015 at 12:51:45PM +0100, Jakub Jelinek wrote: On Tue, Jan 20, 2015 at 12:49:07PM +0100, Marek Polacek wrote: I'd like to backport this patch from trunk to 4.9 so as to fix PR63751. It's safe and has been on trunk for several months. Bootstrapped/regtested on x86_64

[libcpp PATCH] Resolve DR#412 - unevaluated #elif (PR preprocessor/60570)

2015-01-22 Thread Marek Polacek
the preprocessor more permissive, it should hurt nobody. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2015-01-22 Marek Polacek pola...@redhat.com DR#412 PR preprocessor/60570 * directives.c (do_elif): Don't evaluate #elif conditionals when they don't need

Re: [PATCH 3/4] match.pd: Add x | ~(x | y) - x | ~y pattern

2015-01-21 Thread Marek Polacek
On Wed, Jan 21, 2015 at 11:49:53AM +0100, Rasmus Villemoes wrote: gcc.dg/20150120-3.c: New test This is simply the 'dual' of the previous pattern, added for completeness. If this is dual, I think you could make use of (for op (bit_ior bit_and) ... and do the simplification in one hunk.

Re: [patch, libobjc] export __objc_get_forward_imp, get_imp again

2015-01-21 Thread Marek Polacek
On Wed, Jan 21, 2015 at 10:02:07AM +0100, Matthias Klose wrote: __objc_get_forward_imp and get_imp were exported in libobjc since GCC 4.1, for some reason these are not exported anymore in GCC 5 (both declared inline). So either export these as before, or don't export them and bump the

Re: [PATCH] IPA ICF: add no_icf attribute for a function

2015-01-18 Thread Marek Polacek
On Fri, Jan 16, 2015 at 04:04:27PM +0100, Martin Liška wrote: Hello. This patch adds support for __attribute__((no_icf)) that prevents a function being merged with a different one. Tested on x86_64-linux-pc. Ready for trunk? Thanks, Martin From

Re: [PATCH] Fix ubsan and C++14 constexpr ICEs (PR sanitizer/63956)

2015-02-11 Thread Marek Polacek
On Wed, Feb 11, 2015 at 09:44:24AM -0800, Mike Stump wrote: On Feb 11, 2015, at 4:24 AM, Marek Polacek pola...@redhat.com wrote: The following patch splits the test into C and C++ test cases, so hopefully fixing the issue. Ok for trunk? 2015-02-11 Marek Polacek pola...@redhat.com

[PATCH] Fix IFN_OBJECT_SIZE expansion (PR sanitizer/65081)

2015-02-18 Thread Marek Polacek
with some optimizations for the common case. Bootstrap-ubsan passed, bootstrapped/regtested on x86_64-linux, ok for trunk? 2015-02-17 Marek Polacek pola...@redhat.com PR sanitizer/65081 * ubsan.c (OBJSZ_MAX_OFFSET): Define. (ubsan_expand_objsize_ifn): Don't emit run-time check

[C PATCH] Abate -Wformat-signedness warnings (PR c/65040)

2015-02-12 Thread Marek Polacek
); where the warning is just irritating. Fixed by bailing out when we see a value of unsigned type that has been promoted and the conversion specifier is of unsigned type. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2015-02-12 Marek Polacek pola...@redhat.com PR c/65040

Re: [PATCH] Fix UBSAN_OBJECT_SIZE lowering (PR sanitizer/65019)

2015-02-12 Thread Marek Polacek
On Thu, Feb 12, 2015 at 08:43:46AM +0100, Jakub Jelinek wrote: Hi! Similar problem to the recently fixed UBSAN_VPTR lowering, ubsan_expand_objsize_ifn sets *gsi to the first stmt in a new bb after splitting block after UBSAN_OBJECT_SIZE, which is the next stmt that should be processed, so

Re: [PATCH] Fix ICE in early inliner (PR ipa/65008)

2015-02-19 Thread Marek Polacek
On Thu, Feb 19, 2015 at 12:06:40PM +0100, Richard Biener wrote: On Thu, 19 Feb 2015, Marek Polacek wrote: The problem exposed by this PR is (IIUC) that we hadn't gotten around to recomputing the inline parameters in the case when optimize_inline_calls introduces new statements

[PATCH] Fix ICE in early inliner (PR ipa/65008)

2015-02-19 Thread Marek Polacek
below, that is, recomputing the inline parameters. I didn't copied the if that calls gimple_check_call_matching_types and sets edge-call_stmt_cannot_inline_p, I'm not sure if it's needed. Does that make sense? Bootstrapped/regtested on x86_64-linux. 2015-02-19 Marek Polacek pola...@redhat.com

Re: [PATCH][2/5] Add gimple_find_sub_bbs

2015-02-19 Thread Marek Polacek
On Thu, Feb 19, 2015 at 01:48:58PM +0100, Jakub Jelinek wrote: On Thu, Feb 19, 2015 at 01:41:05PM +0100, Richard Biener wrote: I hope we can get rid of this again (which needs re-writing of all targets va-arg gimplification hooks... - we are in need of some generic diamond/triangle CFG

Re: [wwwdocs] Porting to again

2015-02-18 Thread Marek Polacek
On Wed, Feb 18, 2015 at 01:16:55PM +0100, Jakub Jelinek wrote: On Wed, Feb 18, 2015 at 01:04:30PM +0100, Marek Polacek wrote: --- porting_to.html 10 Feb 2015 11:12:20 - 1.3 +++ porting_to.html 18 Feb 2015 12:01:50 - @@ -24,6 +24,17 @@ manner. Additions and suggestions

[wwwdocs] Porting to again

2015-02-18 Thread Marek Polacek
This is a revised version. I reworded the paragraph dealing with __STDC_VERSION__, made some clarifications wrt %a, and added some text wrt cpp -P issue. Ok? Index: porting_to.html === RCS file:

Re: [DOC PATCH] Update for standards.texi

2015-01-29 Thread Marek Polacek
On Thu, Jan 29, 2015 at 10:46:24AM +0100, Marek Polacek wrote: Apparently I failed to update this text when doing the gnu89 - gnu11 change. Ok? 2015-01-29 Marek Polacek pola...@redhat.com * doc/standards.texi: Reflect that the default for C is gnu11. diff --git gcc/doc

[committed] Better location for -Wchar-subscripts (PR c/64423)

2015-01-05 Thread Marek Polacek
warn_array_subscript_with_type_char wasn't getting a location, so the caret location was off. Thus fixed. Bootstrapped/regtested on x86_64-linux, applying to trunk. 2015-01-05 Marek Polacek pola...@redhat.com PR c/64423 c-family/ * c-common.c

[committed] Fix typo in docs

2015-01-05 Thread Marek Polacek
This patch adds a missing comma in the documentation. Applying as obvious. 2015-01-05 Marek Polacek pola...@redhat.com * doc/extend.texi (Arrays of Length Zero): Add missing comma. diff --git gcc/doc/extend.texi gcc/doc/extend.texi index ffefb67..7cd6a56 100644 --- gcc/doc

[C PATCH] Don't accept awkward flexarr member initialization (PR c/64417)

2015-01-06 Thread Marek Polacek
'a' is not at the end of struct B. Bootstrapped/regtested on {ppc64,x86_64}-linux, ok for trunk? 2015-01-06 Marek Polacek pola...@redhat.com PR c/64417 c/ * c-typeck.c (process_init_element): Disallow initialization of a flexible array member with a string constant

[C PATCH] Make -Wdiv-by-zero work even for const ints (PR c/64440)

2015-01-06 Thread Marek Polacek
. The PR is a request for this. Bootstrapped/regtested on {x86_64,ppc64}-linux, ok for trunk? 2015-01-06 Marek Polacek pola...@redhat.com PR c/64440 * c-common.c (c_fully_fold_internal): Warn for division and modulo if orig_op1 isn't INTEGER_CST, op1 is INTEGER_CST

[PATCH] Fix ICE with -fgnu-tm and pragma ivdep (PR middle-end/64391)

2015-01-13 Thread Marek Polacek
don't think internal fns can have transaction_* attributes anyway. While at it, I did some cleanups. Bootstrapped/regtested on {ppc64,x86_64}-linux, ok for trunk? 2015-01-13 Marek Polacek pola...@redhat.com PR middle-end/64391 * trans-mem.c (get_attrs_for): Return NULL_TREE

C PATCH for PR64856 (initializing range of elements in C99)

2015-02-09 Thread Marek Polacek
for trunk? 2015-02-09 Marek Polacek pola...@redhat.com PR c/64856 * c-typeck.c (process_init_element): Don't always wrap COMPOUND_LITERAL_EXPR in a SAVE_EXPR in C99 mode when initializing a range of elements. * gcc.dg/pr64856.c: New test. diff --git gcc/c

[wwwdocs] Add Links section to porting to

2015-02-10 Thread Marek Polacek
porting_to.html --- porting_to.html 15 Jan 2015 10:39:34 - 1.2 +++ porting_to.html 10 Feb 2015 11:10:03 - @@ -251,5 +251,12 @@ b style='color:lime'^/b /pre +h3Links/h3 + +p +Marek Polacek and Jakub Jelinek, + a href=https://lists.fedoraproject.org/pipermail

[C PATCH] Handle typedef name as a flexible array member (PR c/64768)

2015-02-13 Thread Marek Polacek
. Bootstrapped/regtested on {ppc64,x86_64}-linux, ok for trunk? 2015-02-13 Marek Polacek pola...@redhat.com PR c/64768 * c-decl.c (grokdeclarator): Set the range of a flexible array member declared through a typedef name. * gcc.dg/array-11.c: New test. * gcc.dg

Re: [C PATCH] Handle typedef name as a flexible array member (PR c/64768)

2015-02-14 Thread Marek Polacek
On Fri, Feb 13, 2015 at 08:53:38PM +, Joseph Myers wrote: On Fri, 13 Feb 2015, Marek Polacek wrote: Since we had no testing for such cases whatsoever, I took existing flexible array member tests and duplicated them, only adjusted them to use a typedef name, so that we test as many

[wwwdocs] Some stuff for porting to

2015-02-10 Thread Marek Polacek
The following adds a few new notes. Ok? --- porting_to.html 10 Feb 2015 11:12:20 - 1.3 +++ porting_to.html 10 Feb 2015 17:58:52 - @@ -251,6 +251,99 @@ b style='color:lime'^/b /pre +h4code__STDC_VERSION__/code macro/h4 + +pIn the C11 mode, the

Re: [wwwdocs] Some stuff for porting to

2015-02-11 Thread Marek Polacek
On Tue, Feb 10, 2015 at 09:56:48PM +, Joseph Myers wrote: __FUNCTION__ and __func__ aren't macros (essentially they're built-in variables). Oops, I must have been thinking of __STDC_VERSION__ when writing that. Fixed, thanks. Index: porting_to.html

Re: [PATCH] Fix ubsan and C++14 constexpr ICEs (PR sanitizer/63956)

2015-02-11 Thread Marek Polacek
On Sun, Jan 25, 2015 at 12:07:46PM -0800, Mike Stump wrote: On Dec 1, 2014, at 2:52 AM, Marek Polacek pola...@redhat.com wrote: On Sun, Nov 30, 2014 at 11:00:12PM -0500, Jason Merrill wrote: On 11/27/2014 08:57 AM, Marek Polacek wrote: -/* { dg-error is not a constant expression { target c

[C PATCH] Improve diagnostics a tiny bit (PR c/65050)

2015-02-13 Thread Marek Polacek
This patch tweaks an error message a little bit so that we also print the type we're talking about. This is neither a regression nor a bug fix - should I queue this for GCC 6, or is it so minor that it can still go into GCC 5? Bootstrapped/regtested on ppc64-linux. 2015-02-13 Marek Polacek

Re: [PATCH, PR tree-optimization/65002] Disable SRA for functions wrongly marked as read-only

2015-02-13 Thread Marek Polacek
On Thu, Feb 12, 2015 at 05:14:19PM +0300, Ilya Enkovich wrote: Hi, PR65002 is the second issue caused by SRA for functions wrongly marked as read-only. Previous fix for PR64353 doesn't work for this case because SSA update happens too late. Here is a patch to disable SRA for such

[C PATCH] Don't crash on null param (PR c/65066)

2015-02-16 Thread Marek Polacek
The CUR_PARAM can be null at this place, so check for that. I had hoped that extra testing the original patch by running the C testsuite with -Wformat=2 enabled would detect such a case, but apparently not. :( Bootstrapped/regtested on x86_64-linux, ok for trunk? 2015-02-16 Marek Polacek pola

Re: RFC: C++ PATCH to do bounds sanitation for VLA initialization

2015-01-08 Thread Marek Polacek
On Wed, Jan 07, 2015 at 11:56:58PM -0500, Jason Merrill wrote: My recent patch to remove the C++ VLA semantics that didn't make it into C++14 missed a couple of spots. While I was looking at that I noticed that we weren't sanitizing VLA initialization, which we ought to do; this patch

Re: *ping* [patch, fortran] Fix for PR 47676

2015-01-05 Thread Marek Polacek
On Mon, Jan 05, 2015 at 12:51:55PM +0100, Thomas Koenig wrote: Am 30.12.2014 um 01:25 schrieb Thomas Koenig: Hello world, this patch fixes the long-standing bug. A missing temporary causes an invalid read in realloc_on_assign_5.f03 which only becomes noticable when setting

Re: Fix alignment propagation

2015-02-19 Thread Marek Polacek
On Fri, Feb 20, 2015 at 12:39:29AM +0100, Jan Hubicka wrote: Hi, this patch fixes alignment propagation that causes wrong code on solex and firefox. Patch is by Martin, I just added the obvous MINUS_EXPR fix (the offset would be wrong, but I see no reason for MINUX_ExPR appearing there

C++ PATCH for c++/65327 aka DR 1688 (volatile constexpr variables)

2015-03-16 Thread Marek Polacek
though. Bootstrapped/regtested on x86_64-linux, ok for trunk? If so, should this be backported to 4.8/4.9? 2015-03-16 Marek Polacek pola...@redhat.com DR 1688 PR c++/65327 * decl.c (grokdeclarator): Allow volatile and constexpr together. * g++.dg/cpp0x

[PATCH] Remove unused function

2015-03-16 Thread Marek Polacek
This function is unused since matrix-reorg.c removal back in 2012. I think there's no point in keeping it around. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2015-03-16 Marek Polacek pola...@redhat.com * cgraph.h (add_new_static_var): Remove declaration. * varpool.c

Re: [C PATCH] Fix up file-scope _Atomic expansion (PR c/65345)

2015-03-17 Thread Marek Polacek
On Tue, Mar 17, 2015 at 01:32:20PM -0600, Jeff Law wrote: My inclination is to defer unless it's painfully safe (like your removal of unused functions) or it's a regression of some sorts. I think I also slightly prefer deferring this patch; it's not exactly in the painfully safe category.

C++ PATCH for c++/65072 (ICE with anonymous aggregate and decltype)

2015-03-20 Thread Marek Polacek
by doing just that, lookup_anon_field is then able to find the decl and we don't ICE anymore. Bootstrapped/regtested on x86_64-linux, ok for trunk? Strictly speaking, it's not a regression, but the fix doesn't look terribly risky either. 2015-03-20 Marek Polacek pola...@redhat.com PR c

Re: C++ PATCH for c++/65072 (ICE with anonymous aggregate and decltype)

2015-03-20 Thread Marek Polacek
On Fri, Mar 20, 2015 at 01:59:14PM +0100, Richard Biener wrote: Hum... variant types should have the same TYPE_FIELDs as the main variant. So why's the variants TYPE_FIELDS NULL? That is a good question, but unfortunately, even after hours trying to find that out, I don't know. I thought that

Re: C++ PATCH for c++/65398 (valid constexpr rejected)

2015-03-19 Thread Marek Polacek
On Thu, Mar 19, 2015 at 07:17:23PM +0100, Jakub Jelinek wrote: On Thu, Mar 19, 2015 at 07:13:47PM +0100, Marek Polacek wrote: On Thu, Mar 19, 2015 at 07:05:36PM +0100, Jakub Jelinek wrote: I believe cxx_fold_indirect_ref result is not passed through to the middle-end, unless it can

Re: C++ PATCH for c++/65398 (valid constexpr rejected)

2015-03-19 Thread Marek Polacek
On Thu, Mar 19, 2015 at 07:05:36PM +0100, Jakub Jelinek wrote: On Wed, Mar 18, 2015 at 11:08:15AM +0100, Richard Biener wrote: On Fri, Mar 13, 2015 at 3:40 PM, Marek Polacek pola...@redhat.com wrote: We started to reject this (IMHO valid) testcase with r214941 that did away

Re: C++ PATCH for c++/65398 (valid constexpr rejected) (take 2)

2015-03-20 Thread Marek Polacek
), + TREE_OPERAND (op00, 1)); + t = size_binop_loc (loc, PLUS_EXPR, op01, t); This seems to be assuming that the elements are size 1. Dunno how I flubbed that. Fixed. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2015-03-20 Marek Polacek pola

Re: [PATCH] Use do_ubsan_in_current_function more

2015-03-09 Thread Marek Polacek
On Mon, Mar 09, 2015 at 12:48:56PM +0100, Jakub Jelinek wrote: --- gcc/cp/cp-ubsan.c +++ gcc/cp/cp-ubsan.c @@ -63,9 +63,7 @@ cp_ubsan_instrument_vptr_p (tree type) if (!flag_rtti || flag_sanitize_undefined_trap_on_error) return false; - if (current_function_decl -

[PATCH] Use do_ubsan_in_current_function more

2015-03-09 Thread Marek Polacek
I noticed that we can use the do_ubsan_in_current_function wrapper more, which allows us to simplify the code a bit further. Ran ubsan testsuite on x86_64-linux, ok for trunk? 2015-03-09 Marek Polacek pola...@redhat.com * c-convert.c (convert): Make use of do_ubsan_in_current_function

[PATCH] Add cfun printing to gdbinit.in

2015-03-10 Thread Marek Polacek
Marek Polacek pola...@redhat.com * gdbinit.in (pcfun): Define and document. diff --git gcc/gdbinit.in gcc/gdbinit.in index 10fe5ad..436de06 100644 --- gcc/gdbinit.in +++ gcc/gdbinit.in @@ -199,6 +199,15 @@ document pel Print expanded location of $. end +define pcfun +output

Re: [PATCH] Add cfun printing to gdbinit.in

2015-03-10 Thread Marek Polacek
On Tue, Mar 10, 2015 at 11:33:13AM +0100, Richard Biener wrote: Isn't cfun-decl much more likely to work? Dunno, if that's the case, then: 2015-03-10 Marek Polacek pola...@redhat.com * gdbinit.in (pcfun): Define and document. diff --git gcc/gdbinit.in gcc/gdbinit.in index 10fe5ad

[PATCH] Backport ubsan fix to 4.9

2015-03-12 Thread Marek Polacek
I'd like to backport the following patch that suppresses bogus ubsan errors. I had to tweak the testcase a bit since 4.9 doesn't know -fno-sanitize-recover. Bootstrapped/regtested on x86_64-linux, ok for 4.9? 2015-03-10 Marek Polacek pola...@redhat.com Backported from mainline

[PATCH] Fix ubsan's flexible array member handling (PR sanitizer/65280)

2015-03-05 Thread Marek Polacek
hear no objections, I'll apply this tomorrow. 2015-03-05 Marek Polacek pola...@redhat.com Martin Uecker uec...@eecs.berkeley.edu PR sanitizer/65280 * doc/invoke.texi: Update description of -fsanitize=bounds. * c-ubsan.c (ubsan_instrument_bounds): Check

[PATCH] Fix -fsanitize=object-size expansion (PR sanitizer/65367)

2015-03-10 Thread Marek Polacek
the iterator. Bootstrapped/regtested on x86_64-linux, applying to trunk. 2015-03-10 Marek Polacek pola...@redhat.com Jakub Jelinek ja...@redhat.com PR sanitizer/65367 * ubsan.c (ubsan_expand_objsize_ifn): Update GSI instead of GSI_ORIG when only removing

[PATCH] Fix typo in tail merging (PR tree-optimization/65388)

2015-03-11 Thread Marek Polacek
This patch fixes a pretty obvious typo: we couldn't possibly want to test whether a variable equals itself. PR c/54979 is an RFE for a warning that would detect such cases. Bootstrapped/regtested on x86_64-linux, ok for active branches? 2015-03-11 Marek Polacek pola...@redhat.com PR

[C PATCH] Fix up file-scope _Atomic expansion (PR c/65345)

2015-03-12 Thread Marek Polacek
at this juncture... Comments? Bootstrapped/regtested on x86_64-linux. 2015-03-12 Marek Polacek pola...@redhat.com PR c/65345 * c-decl.c (set_labels_context_r): New function. (store_parm_decls): Call it via walk_tree_without_duplicates. * c-typeck.c

C++ PATCH for c++/65398 (valid constexpr rejected)

2015-03-13 Thread Marek Polacek
on x86_64-linux, ok for trunk? 2015-03-13 Marek Polacek pola...@redhat.com PR c++/65398 * constexpr.c (cxx_fold_indirect_ref): Transform *(A[i] p+ j) into A[i + j]. * g++.dg/cpp0x/pr65398.C: New test. diff --git gcc/cp/constexpr.c gcc/cp/constexpr.c index 1b5f50c

C++ PATCH for c++/61670 (ice-after-error with null DECL_SIZE)

2015-03-25 Thread Marek Polacek
The following fixes an ICE on invalid code by checking that DECL_SIZE is not null before feeding it to integer_zerop. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2015-03-25 Marek Polacek pola...@redhat.com PR c++/61670 * class.c (remove_zero_width_bit_fields): Check

C++ PATCH for c++/65558 (ICE with abi_tag on anon namespace)

2015-03-25 Thread Marek Polacek
As discussed in the PR, the abi_tag on an anonymous namespace is useless, but we shouldn't ICE if the user attempts to do that. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2015-03-25 Marek Polacek pola...@redhat.com PR c++/65558 * name-lookup.c

[committed] Fix c++/65556 testcase

2015-03-30 Thread Marek Polacek
Apparently 41-bit bit-fields with type long can't be used on archs with 32-bit long. Applying to trunk. 2015-03-30 Marek Polacek pola...@redhat.com * c-c++-common/pr65556.c: Change the width of bit-fields. diff --git gcc/testsuite/c-c++-common/pr65556.c gcc/testsuite/c-c++-common

Re: C++ PATCH for c++/65556 (ICE with switch and bit-fields)

2015-03-30 Thread Marek Polacek
On Mon, Mar 30, 2015 at 04:02:36PM +0200, Jakub Jelinek wrote: On Mon, Mar 30, 2015 at 03:00:54PM +0100, James Greenhalgh wrote: Likewise on ARM. The testcase is fairly obviously not going to work for any target with 32-bit long: struct S { long l: 1; long l2: 41;

C++ PATCH for c++/65398 (valid constexpr rejected once again)

2015-03-30 Thread Marek Polacek
context. One change is that I had to wrap the folded ARRAY_REF into an ADDR_EXPR: we're not necessarily dereferencing the array. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2015-03-30 Marek Polacek pola...@redhat.com PR c++/65398 * constexpr.c (cxx_fold_indirect_ref

Re: [patch c++]: Fix for PR/65390

2015-03-31 Thread Marek Polacek
. Not a regression, so we might want to defer this patch to the next stage1. 2015-03-31 Marek Polacek pola...@redhat.com PR c++/65390 * tree.c (build_cplus_array_type): Use dependent_type_p rather than checking for constness. * g++.dg/template/pr65390.C: New test

Re: [patch c++]: Fix for PR/65390

2015-03-31 Thread Marek Polacek
On Tue, Mar 31, 2015 at 02:32:32PM +0200, Marek Polacek wrote: On Tue, Mar 31, 2015 at 02:25:14PM +0200, Kai Tietz wrote: Hi, I had tried same approach as Marek. For me it solved the PR, but caused other regressions on boostrap. So I dropped the way via dependent_type_p. Well

Re: [patch c++]: Fix for PR/65390

2015-03-31 Thread Marek Polacek
On Tue, Mar 31, 2015 at 02:25:14PM +0200, Kai Tietz wrote: Hi, I had tried same approach as Marek. For me it solved the PR, but caused other regressions on boostrap. So I dropped the way via dependent_type_p. Well, this bootstrap-issue might be caused by some local changes I had forgot

Re: [C++ Patch/RFC] PR 56100

2015-04-01 Thread Marek Polacek
On Wed, Apr 01, 2015 at 12:02:36PM +0200, Paolo Carlini wrote: --- cp/pt.c (revision 221795) +++ cp/pt.c (working copy) @@ -20773,6 +20773,13 @@ current_instantiation (void) return current_tinst_level; } +bool +instantiating_current_function_p (void) +{ + return

Re: C++ PATCH for c++/65554 (ICE with user-defined initializer_list)

2015-04-01 Thread Marek Polacek
On Tue, Mar 31, 2015 at 03:11:24PM -0400, Jason Merrill wrote: On 03/31/2015 01:22 PM, Marek Polacek wrote: The user *should* have been using initializer_list. But responding to this with an ICE isn't acceptable either. We do reject wholly incompatible user-defined initializer_list

[PATCH] Fix typo in a comment

2015-03-27 Thread Marek Polacek
Ok? 2015-03-27 Marek Polacek pola...@redhat.com * gimple-iterator.h (gsi_prev_nondebug): Fix typo. diff --git gcc/gimple-iterator.h gcc/gimple-iterator.h index 6be88dd..9aa7508 100644 --- gcc/gimple-iterator.h +++ gcc/gimple-iterator.h @@ -250,7 +250,7 @@ gsi_next_nondebug

C++ PATCH for c++/65556 (ICE with switch and bit-fields)

2015-03-27 Thread Marek Polacek
been doing before the -Wswitch fix, which ought to make this fix very safe. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2015-03-27 Marek Polacek pola...@redhat.com PR c++/65556 * semantics.c (finish_switch_cond): If the unlowered type is not an enum, use the type

C++ PATCH for c++/65554 (ICE with user-defined initializer_list)

2015-03-31 Thread Marek Polacek
only a part of the PR. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2015-03-31 Marek Polacek pola...@redhat.com PR c++/65554 * call.c (convert_like_real): Build integer constant with the field type, not always of size_type. * g++.dg/cpp0x/initlist93.C

Re: [patch c++]: Fix for PR/65390

2015-03-31 Thread Marek Polacek
On Tue, Mar 31, 2015 at 02:32:32PM +0200, Marek Polacek wrote: Of course, with --enable-languages=all. I'll re-run the bootstrap with more languages enabled, though. --enable-languages=all,obj-c++,go bootstrap passed again on x86_64 and ppc64. Marek

Re: [PATCH] ubsan: improve bounds checking, add -fsanitize=bounds-strict

2015-03-02 Thread Marek Polacek
On Fri, Feb 27, 2015 at 11:53:14AM -0800, Martin Uecker wrote: I tested Marek's proposed change and it works correctly, i.e. arrays which are not part of a struct are now instrumented when accessed through a pointer. This also means that the following case is diagnosed (correctly) as

Re: [PATCH] Fix PR65261

2015-03-02 Thread Marek Polacek
On Mon, Mar 02, 2015 at 06:22:49PM +0100, Markus Trippelsdorf wrote: --- 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__

<    4   5   6   7   8   9   10   11   12   13   >