The problem in this testcase is that the front end expects an rvalue
COND_EXPR to initialize a single temporary from one of the arms. But
because gimplify_cond_expr used MODIFY_EXPR, instead the arms would each
create their own temporary and then copy that into the common temporary.
So, let's use INIT_EXPR instead.
* gimplify.c (gimplify_cond_expr): Use INIT_EXPR.
From-SVN: r269403
* class.c (is_really_empty_class): Add ignore_vptr parm.
While looking at PR86485, I noticed that many uses of is_really_empty_class
were overlooking that it returned true for a class with only a vptr;
initialization of such a class is not trivial. Marek's P1064 patch fixed
one place in constexpr.c to also check for a vtable, but there are several
others that still don't.
This patch requires callers to explicitly choose which behavior they want.
Currently the uses in constexpr.c want to consider the vptr, and other uses
don't.
* class.c (is_really_empty_class): Add ignore_vptr parm.
(trivial_default_constructor_is_constexpr): Pass it.
* call.c (build_over_call): Pass it.
* constexpr.c (cxx_eval_constant_expression): Pass it instead of
checking TYPE_POLYMORPHIC_P.
(cxx_eval_component_reference, potential_constant_expression_1):
Pass it.
* cp-gimplify.c (simple_empty_class_p): Pass it.
* init.c (expand_aggr_init_1): Pass it.
From-SVN: r269402
If there is no f_flags field in statfs_t then rename one of the
f_spare fields, as happened in Linux kernel version 2.6.36. This
fixes the build on CentOS 5.11. The CentOS kernel will hopefully not
fill in the f_spare field, so the resulting flags will be zero.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/165417
From-SVN: r269401
The implementation of midpoint used for integral types is due to Howard
Hinnant and avoids a branch for int and larger types (but not for chars
and shorts).
The midpoint and lerp functions for floating point types come straight
from the P0811R3 proposal, with no attempt at optimization.
* include/c_compatibility/math.h [C++20] (lerp): Add using
declaration.
* include/c_global/cmath [C++20] (__cpp_lib_interpolate): Define.
(__lerp): Define function template to implement lerp.
(lerp(float, float, float), lerp(double, double, double))
(lerp(long double, long double, long double)): Define for C++20.
* include/std/numeric [C++20] (__cpp_lib_interpolate): Define.
(midpoint(T, T), midpoint(T*, T*)): Define.
* include/std::version [C++20] (__cpp_lib_interpolate): Define.
* testsuite/26_numerics/lerp.cc: New test.
* testsuite/26_numerics/midpoint/floating.cc: New test.
* testsuite/26_numerics/midpoint/integral.cc: New test.
* testsuite/26_numerics/midpoint/pointer.cc: New test.
From-SVN: r269398
2019-03-05 Christophe Lyon <christophe.lyon@linaro.org>
contrib/
* dg-extract-results.py: Handle case where a WARNING happens with
the first test of a harness.
From-SVN: r269394
2019-03-05 Christophe Lyon <christophe.lyon@linaro.org>
contrib/
* dg-extract-results.sh: Fix order of WARNING and following test
result.
From-SVN: r269393
PR middle-end/89590
* builtins.c (maybe_emit_free_warning): Punt if free doesn't have
exactly one argument.
* gcc.dg/pr89590.c: New test.
From-SVN: r269392
PR tree-optimization/89570
* match.pd (vec_cond into cond_op simplification): Don't use
get_conditional_internal_fn, use as_internal_fn (cond_op).
Co-Authored-By: Richard Sandiford <richard.sandiford@arm.com>
From-SVN: r269391
The GCC optimizer can generate symbols with non-zero offset from simple
if-statements. Bit zero is used for the Arm/Thumb state bit, so relocations
with offsets fail if it changes bit zero and the relocation forces bit zero
to true. The fix is to disable offsets on function pointer symbols.
gcc/
PR target/89222
* config/arm/arm.md (movsi): Use targetm.cannot_force_const_mem
to decide when to split off a non-zero offset from a symbol.
* config/arm/arm.c (arm_cannot_force_const_mem): Disallow offsets
in function symbols.
testsuite/
PR target/89222
* gcc.target/arm/pr89222.c: Add new test.
From-SVN: r269390
2019-03-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/89594
* tree-if-conv.c (pass_if_conversion::execute): Handle
case where .LOOP_VECTORIZED_FUNCTION was removed.
* gcc.dg/pr89594.c: New testcase.
From-SVN: r269389
PR tree-optimization/89487
* gcc.dg/tree-ssa/pr89487.c: Include ../pr87600.h.
(caml_interprete): Ifdef the whole body out if REG1 or REG2 macros
aren't defined. Use REG1 instead of "%r15" and REG2 instead of
"%r14".
From-SVN: r269388
PR bootstrap/89560
* fold-const.c (fold_checksum_tree): Don't use fixed size buffer,
instead alloca it only when needed with the needed size.
* g++.dg/other/pr89560.C: New test.
From-SVN: r269386
PR tree-optimization/89570
* match.pd (vec_cond into cond_op simplification): Guard with
vectorized_internal_fn_supported_p test and #if GIMPLE.
* gcc.dg/pr89570.c: New test.
From-SVN: r269385
PR tree-optimization/89566
* gimple-ssa-sprintf.c (sprintf_dom_walker::handle_gimple_call):
Set info.fncode to BUILT_IN_NONE if gimple_call_builtin_p failed.
Punt if get_user_idx_format succeeds, but idx_format argument is
not provided or doesn't have pointer type, or if idx_args is above
number of provided arguments.
* c-c++-common/pr89566.c: New test.
From-SVN: r269384
2019-03-04 Edward Smith-Rowland <3dw4rd@verizon.net>
PR libstdc++/88996 Implement P0439R0
Make std::memory_order a scoped enumeration.
* include/bits/atomic_base.h: For C++20 make memory_order a scoped enum,
add variables for the old enumerators. Adjust calls.
* testsuite/29_atomics/headers/atomic/types_std_c++2a.cc: New test.
* testsuite/29_atomics/headers/atomic/types_std_c++2a_neg.cc: New test.
From-SVN: r269372
The test options_set_10.c shouldn't run when cross compiled.
In addition to gating it on linux I'm also gating it on native now.
gcc/testsuite/ChangeLog:
PR target/88530
* gcc.target/aarch64/options_set_10.c:
From-SVN: r269366
Fix PR89437
Fix PR89437. Fix the sinatan-1.c testcase to not run without
a C99 target system. Use nextafterl for long double initialization.
Fix an issue with sinl (atanl (sqrtl (LDBL_MAX)) returning 0.0
instead of 1.0 by using x < sqrtl (LDBL_MAX) in match.pd.
gcc/
PR tree-optimization/89437
* match.pd: Use lt in sin(atan(x)) and cos(atan(x)) simplifications.
testsuite/
PR tree-optimization/89437
* gcc.dg/sinatan-1.c: Fix testcase.
From-SVN: r269364
PR tree-optimization/89487
* tree-loop-distribution.c (has_nonaddressable_dataref_p): New.
(create_rdg_vertices): Compute has_nonaddressable_dataref_p.
(distribute_loop): Don't do runtime alias check if there is non-
addressable data reference.
* tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Check if VAR_DECL
is a register variable.
* gcc/testsuite/gcc.dg/tree-ssa/pr89487.c: New test.
From-SVN: r269361
2019-03-03 Harald Anlauf <anlauf@gmx.de>
Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77583
* symbol.c (check_conflict): Check for valid procedure name
passed to error reporting routine.
PR fortran/77583
* gfortran.dg/pr77583.f90: New test.
Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org>
From-SVN: r269353
2019-03-02 Harald Anlauf <anlauf@gmx.de>
PR fortran/89516
* check.c (gfc_calculate_transfer_sizes): Correct checks for cases
where storage size of elements of MOLD is 0.
PR fortran/89516
* gfortran.dg/pr89492.f90: Adjust testcase.
* gfortran.dg/transfer_check_5.f90: New test.
From-SVN: r269341
PR c++/71446
* cp-tree.h (CONSTRUCTOR_IS_DESIGNATED_INIT): Define.
* parser.c (cp_parser_braced_list): Adjust cp_parser_initializer_list
caller, set CONSTRUCTOR_IS_DESIGNATED_INIT.
(cp_parser_initializer_list): Add designated parameter, set *designated
to a bool whether any designators were parsed.
* decl.c (reshape_init): Copy over CONSTRUCTOR_IS_DESIGNATED_INIT if
needed.
* pt.c (tsubst_copy_and_build): Likewise.
* call.c (implicit_conversion): If CONSTRUCTOR_IS_DESIGNATED_INIT,
don't call build_list_conv, nor build_complex_conv, nor attempt to
convert a single element initializer to scalar.
* g++.dg/cpp2a/desig10.C: New test.
* g++.dg/cpp2a/desig11.C: New test.
* g++.dg/ext/desig4.C: Expect 4 new errors.
From-SVN: r269340
PR target/89506
* config/arm/arm.md (cmpsi2_addneg): Use
trunc_int_for_mode (-INTVAL (...), SImode) instead of -INTVAL (...).
If operands[2] is 0 or INT_MIN, force use of subs.
(*compare_scc splitter): Use gen_int_mode.
(*negscc): Likewise.
* config/arm/thumb2.md (*thumb2_negscc): Likewise.
* gcc.dg/pr89506.c: New test.
From-SVN: r269339
This is the result of these two oneliners:
perl -ni -e 'print unless /dg-skip-if "do not override -mcpu"/' \
$(find gcc/testsuite/gcc.target/powerpc/ -type f)
perl -pi -e 's/(dg-options.*)-mcpu=/\1-mdejagnu-cpu=/' \
$(find gcc/testsuite/gcc.target/powerpc/ -type f)
gcc/testsuite/
* gcc.target/powerpc/ throughout: Delete dg-skip-if "do not override
-mcpu". Use -mdejagnu-cpu= in dg-options instead of -mcpu=.
From-SVN: r269324
This adds an option -mdejagnu-cpu=. This option simply overrides what
is given in -mcpu=. The reason for this is that with older versions
of DejaGnu the value given in the RUNTESTFLAGS will override the value
a testcase wants to have.
* config/rs6000/rs6000.c (rs6000_option_override_internal): If
rs6000_dejagnu_cpu_index is set, use that to override rs6000_cpu_index.
* config/rs6000/rs6000.opt (mdejagnu-cpu=): New option.
From-SVN: r269322
PR rtl-optimization/85899
* haifa-sched.c (find_fallthru_edge_from): Relax assert to account for
fallthru edges leading to the exit block.
* gcc.dg/pr85899.c: New test.
From-SVN: r269319
Interpreting auxv as []uintptr is incorrect on 64-bit big-endian,
as auxv alternates a 32-bit int with a 64-bit pointer.
Patch from Rainer Orth.
Reviewed-on: https://go-review.googlesource.com/c/164739
From-SVN: r269315
Implement P1002R1, Try-catch blocks in constexpr functions
PR c++/89513
* parser.c (cp_parser_ctor_initializer_opt_and_function_body):
Diagnose constexpr ctor or function with function-try-block with
pedwarn for c++17 and earlier. Formatting fix.
(cp_parser_try_block): Use pedwarn instead of error and only for
c++17 and earlier when try block appears in constexpr function.
* constexpr.c (build_constexpr_constructor_member_initializers):
Handle TRY_BLOCK here instead of erroring on it.
* g++.dg/cpp2a/constexpr-try1.C: New test.
* g++.dg/cpp2a/constexpr-try2.C: New test.
* g++.dg/cpp2a/constexpr-try3.C: New test.
* g++.dg/cpp2a/constexpr-try4.C: New test.
* g++.dg/cpp2a/constexpr-try5.C: New test.
* g++.dg/cpp0x/constexpr-ctor10.C: Don't expect error for C++2a.
From-SVN: r269314