gcc/ada/
* exp_fixd.adb (Build_Double_Divide): Use the RM size of types and
a more precise estimate for the size of the denominator.
(Build_Double_Divide_Code): Likewise.
(Build_Multiply): Use a more precise estimate for the size of the
result.
(Build_Scaled_Divide): Use the RM size of types and a more precise
estimate for the size of the numerator.
(Build_Scaled_Divide_Code): Likewise.
rs6000_expand_vector_set could accept insert either to constant position
or variable position, so change the operand to reg_or_cint_operand.
gcc/ChangeLog:
2020-11-27 Xionghu Luo <luoxhu@linux.ibm.com>
* config/rs6000/rs6000-call.c (altivec_expand_vec_set_builtin):
Change call param 2 from type int to rtx.
* config/rs6000/rs6000-protos.h (rs6000_expand_vector_set):
Likewise.
* config/rs6000/rs6000.c (rs6000_expand_vector_init):
Change call param 2 from type int to rtx.
(rs6000_expand_vector_set): Likewise.
* config/rs6000/vector.md (vec_set<mode>): Support both constant
and variable index vec_set.
In order to simplify the preprocessor checks for whether __atomic_wait
is available, this commit does:
-#if defined _GLIBCXX_HAS_GTHREADS || _GLIBCXX_HAVE_LINUX_FUTEX
+#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT
The original was wrong anyway, as it should have used 'defined' to check
_GLIBCXX_HAVE_LINUX_FUTEX (for consistency with how that's used
elsewhere).
The new macro is defined in <bits/atomic_wait.h> when the file is
defines __atomic_wait and related facilities. All other code that
depends on those features can just check the one macro.
libstdc++-v3/ChangeLog:
* include/bits/atomic_wait.h (_GLIBCXX_HAVE_ATOMIC_WAIT):
Define.
* include/bits/atomic_base.h: Check _GLIBCXX_HAVE_ATOMIC_WAIT.
* include/bits/atomic_timed_wait.h: Likewise.
* include/bits/semaphore_base.h: Likewise.
* include/std/atomic: Likewise.
* include/std/latch: Likewise.
* include/std/semaphore: Likewise.
Also fix copy&pasted comments referring to the wrong things.
libstdc++-v3/ChangeLog:
* testsuite/lib/libstdc++.exp (check_effective_target_gthreads):
Call check_v3_target_gthreads not check_v3_target_gthreads_timed.
While we have `configure' checks for the individual POSIX 2008 extended
locale functions we refer to and use to guard the respective call sites,
we only verify the presence of `newlocale' for our global feature enable
check. Consequently compilation fails for targets like NetBSD that only
have partial support for POSIX 2008 locale features and in particular
lack the `uselocale' function:
.../libgfortran/io/transfer.c: In function 'data_transfer_init_worker':
.../libgfortran/io/transfer.c:3416:30: error:
'old_locale_lock' undeclared (first use in this function)
3416 | __gthread_mutex_lock (&old_locale_lock);
| ^~~~~~~~~~~~~~~
.../libgfortran/io/transfer.c:3416:30: note: each undeclared identifier is reported only once for each function it appears in
.../libgfortran/io/transfer.c:3417:12: error:
'old_locale_ctr' undeclared (first use in this function)
3417 | if (!old_locale_ctr++)
| ^~~~~~~~~~~~~~
.../libgfortran/io/transfer.c:3419:11: error:
'old_locale' undeclared (first use in this function); did you mean 'c_locale'?
3419 | old_locale = setlocale (LC_NUMERIC, NULL);
| ^~~~~~~~~~
| c_locale
.../libgfortran/io/transfer.c: In function 'finalize_transfer':
.../libgfortran/io/transfer.c:4253:26: error:
'old_locale_lock' undeclared (first use in this function)
4253 | __gthread_mutex_lock (&old_locale_lock);
| ^~~~~~~~~~~~~~~
.../libgfortran/io/transfer.c:4254:10: error:
'old_locale_ctr' undeclared (first use in this function)
4254 | if (!--old_locale_ctr)
| ^~~~~~~~~~~~~~
.../libgfortran/io/transfer.c:4256:30: error:
'old_locale' undeclared (first use in this function); did you mean 'c_locale'?
4256 | setlocale (LC_NUMERIC, old_locale);
| ^~~~~~~~~~
| c_locale
make[3]: *** [Makefile:6221: transfer.lo] Error 1
Only enable the use of POSIX 2008 extended locale features then when all
the three functions required are present, removing said build errors.
libgfortran/
* io/io.h [HAVE_NEWLOCALE]: Also check for HAVE_FREELOCALE and
HAVE_USELOCALE.
[HAVE_FREELOCALE && HAVE_NEWLOCALE && HAVE_USELOCALE]
(HAVE_POSIX_2008_LOCALE): New macro.
(st_parameter_dt) [HAVE_NEWLOCALE]: Check for
HAVE_POSIX_2008_LOCALE instead.
* io/transfer.c (data_transfer_init_worker, finalize_transfer)
[HAVE_USELOCALE]: Check for HAVE_POSIX_2008_LOCALE instead.
* io/unit.c [HAVE_NEWLOCALE]: Likewise.
(init_units) [HAVE_NEWLOCALE]: Likewise.
(close_units) [HAVE_FREELOCALE]: Likewise.
* runtime/error.c (gf_strerror) [HAVE_USELOCALE]: Likewise.
The *_HAS_* floating-point feature macros are defined as 0/1 rather than
#undef/#define settings by gcc/c-family/c-cppbuiltin.c. Consequently we
choose to use infinity and NaN features even with non-IEEE-754 targets
such as `vax-netbsdelf' that lack them, causing build warnings and
failures like:
In file included from .../libgfortran/generated/maxval_r4.c:26:
.../libgfortran/generated/maxval_r4.c: In function 'maxval_r4':
.../libgfortran/libgfortran.h:292:30: warning: target format does not support infinity
292 | # define GFC_REAL_4_INFINITY __builtin_inff ()
| ^~~~~~~~~~~~~~
.../libgfortran/generated/maxval_r4.c:149:19:
note: in expansion of macro 'GFC_REAL_4_INFINITY'
149 | result = -GFC_REAL_4_INFINITY;
| ^~~~~~~~~~~~~~~~~~~
.../libgfortran/generated/maxval_r4.c: In function 'mmaxval_r4':
.../libgfortran/libgfortran.h:292:30: warning: target format does not support infinity
292 | # define GFC_REAL_4_INFINITY __builtin_inff ()
| ^~~~~~~~~~~~~~
.../libgfortran/generated/maxval_r4.c:363:19:
note: in expansion of macro 'GFC_REAL_4_INFINITY'
363 | result = -GFC_REAL_4_INFINITY;
| ^~~~~~~~~~~~~~~~~~~
{standard input}: Assembler messages:
{standard input}:204: Fatal error: Can't relocate expression
make[3]: *** [Makefile:3358: maxval_r4.lo] Error 1
Correct the checks then for __FLT_HAS_INFINITY__, __DBL_HAS_INFINITY__,
__LDBL_HAS_INFINITY__, __FLT_HAS_QUIET_NAN__, __DBL_HAS_QUIET_NAN__, and
__LDBL_HAS_QUIET_NAN__ to match semantics and remove build issues coming
from the misinterpretation of these macros.
libgfortran/
* libgfortran.h: Use #if rather than #ifdef with
__FLT_HAS_INFINITY__, __DBL_HAS_INFINITY__,
__LDBL_HAS_INFINITY__, __FLT_HAS_QUIET_NAN__,
__DBL_HAS_QUIET_NAN__, and __LDBL_HAS_QUIET_NAN__.
These tests are very, very slow to compile. If the testsuite is run with
a low tool_timeout value they are likely to fail. By adding a
multiplication factor to those tests, it's still possible to use a low
timeout without spurious failures.
libstdc++-v3/ChangeLog:
* testsuite/28_regex/algorithms/regex_match/basic/string_range_01_03.cc:
Add dg-timeout-factor directive.
* testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc:
Likewise.
* testsuite/28_regex/algorithms/regex_match/ecma/char/backref.cc:
Likewise.
* testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/63199.cc:
Likewise.
* testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/anymatcher.cc:
Likewise.
* testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/cjk_match.cc:
Likewise.
* testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/hex.cc:
Likewise.
* testsuite/28_regex/algorithms/regex_match/extended/wstring_locale.cc:
Likewise.
* testsuite/28_regex/algorithms/regex_search/61720.cc: Likewise.
* testsuite/28_regex/algorithms/regex_search/ecma/assertion.cc:
Likewise.
* testsuite/28_regex/algorithms/regex_search/ecma/string_01.cc:
Likewise.
* testsuite/28_regex/basic_regex/ctors/deduction.cc: Likewise.
This allows the default timeout for libstdc++ tests to be set by the
user, either in ~/.dejagnurc or a site.exp file that $DEJAGNU names.
libstdc++-v3/ChangeLog:
* testsuite/lib/libstdc++.exp (libstdc++_init): Only set
tool_timeout if it hasn't been set by the user already.
The missed notifications fixed in r11-5383 also happen in some other
tests which have similar code.
libstdc++-v3/ChangeLog:
PR libstdc++/97936
* testsuite/29_atomics/atomic/wait_notify/bool.cc: Fix missed
notifications by making the new thread wait until the parent
thread is waiting on the condition variable.
* testsuite/29_atomics/atomic/wait_notify/pointers.cc: Likewise.
* testsuite/29_atomics/atomic_flag/wait_notify/1.cc: Likewise.
* testsuite/29_atomics/atomic_ref/wait_notify.cc: Likewise.
This adds a new "futex" effective-target keyword that can be used to
selectively enable/disable tests based on _GLIBCXX_HAVE_LINUX_FUTEX,
instead of checking for that macro in the code.
It also adds "gthreads" as another one, to make the result of the
dg-require-gthreads directive usable in target selectors.
With these new keywords two tests that are currently only run for linux
can also be run for targets using gthr-single.h (e.g. AIX single-thread
multilib, and targets without a gthreads implementation).
libstdc++-v3/ChangeLog:
* testsuite/18_support/96817.cc: Use new effective-target
keywords to select supported targets more effectively.
* testsuite/30_threads/call_once/66146.cc: Likewise.
* testsuite/lib/libstdc++.exp (check_effective_target_futex):
Define new proc.
(check_effective_target_gthreads): Define new proc to replace
dg-require-gthreads.
After 15 years trying to find out what can go into the delay slot of
the call to __tls_get_addr with the Solaris linker, it's now time to
concede defeat and consider it as not to be filled.
gcc/ChangeLog:
PR target/96607
* config/sparc/sparc-protos.h (eligible_for_call_delay): Delete.
* config/sparc/sparc.c (eligible_for_call_delay): Likewise.
* config/sparc/sparc.md (in_call_delay): Likewise.
(tls_delay_slot): New attribute.
(define_delay [call]): Use in_branch_delay.
(tgd_call<P:mode>): Set type to call_no_delay_slot when
tls_delay_slot is false.
(tldm_call<P:mode>): Likewise.
For signed integers with undefined overflow we already optimize x * y / y
into x, but for signed integers with -fwrapv or unsigned integers we don't.
The following patch allows optimizing that into just x if value ranges
prove that x * y will never overflow.
It uses the global SSA_NAME_RANGE_INFO only, because like mentioned
in another PR we don't currently have a way to tell the ranger from match.pd
the use stmt (and we'd need in that case to tell ranger to only follow
SSA_NAME_DEF_STMTs + SSA_NAME_RANGE_INFO and never go in the other
direction, as following immediate uses seems forbidden in match.pd).
Another possibility would be to optimize this during vrp, but on the
other side the optimization itself is match.pd-ish.
2020-11-26 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/97997
* match.pd ((t * 2) / 2) -> t): Optimize even for defined
overflow if ranges prove there is no overflow.
* gcc.dg/tree-ssa/pr97997-1.c: New test.
* gcc.dg/tree-ssa/pr97997-2.c: New test.
EVRP records some ranges from asserts into SSA_NAME_RANGE_INFO
but fails to assert that the condition the range is derived from
is always true after the SSA names definition. The patch implements
the simplest post-dominance check, basic-block equality.
2020-11-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/97953
* gimple-ssa-evrp-analyze.c
(evrp_range_analyzer::record_ranges_from_incoming_edge): Make
sure the condition post-dominates the SSA definition before
recording into SSA_NAME_RANGE_INFO.
* gcc.dg/pr97953.c: New testcase.
This fixes the condition to match the comment and only lower
VECTOR_BOOLEAN_TYPE_P VEC_COND_EXPRs.
2020-11-26 Richard Biener <rguenther@suse.de>
* gimple-isel.cc (gimple_expand_vec_cond_expr): Only
lower VECTOR_BOOLEAN_TYPE_P VEC_COND_EXPRs.
The relocation symbols were inadvertantly wiped when the type was set in
mkoffload.
gcc/ChangeLog
* config/gcn/mkoffload.c (copy_early_debug_info): Don't wipe
relocation symbols.
There is no need for struct with rtx and mode members since mode is never used.
2020-11-26 Uroš Bizjak <ubizjak@gmail.com>
gcc/
* config/i386/i386-expand.c (ix86_expand_multi_arg_builtin):
Remove args array of structs, declare rtx xops array instead.
Update all uses.
(ix86_expand_args_builtin): Ditto.
(ix86_expand_round_builtin): Ditto.
(ix86_expand_special_args_builtin): Ditto.
I recently noticed that neither libposix4 nor librt are needed on
Solaris 11 any longer:
* libposix4 was renamed to librt in Solaris 7 back in 1998.
* librt was folded into libc in the OpenSolaris timeframe, leaving librt
only as a filter on libc. Thus, it's no longer needed on either
Solaris 11 or Illumos.
The following patch removes both uses. At the same time, Ada's use of
libthread has gone: it was folded into libc in Solaris 10 already.
TIME_LIBRARY and friends in g++ are likewise removed: Solaris was the
only user.
Bootstrapped without regressions on i386-pc-solaris2.11,
sparc-sun-solaris2.11, and x86_64-pc-linux-gnu.
2020-11-16 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
gcc/cp:
* g++spec.c (TIMELIB, TIME_LIBRARY): Remove.
(lang_specific_driver): Remove TIME_LIBRARY handling.
gcc:
* config/sol2.h (TIME_LIBRARY): Remove.
libstdc++-v3:
* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Remove libposix4
references.
<solaris*>: Don't use -lrt any longer.
* configure: Regenerate.
* doc/xml/manual/configure.xml (--enable-libstdcxx-time=OPTION):
Remove libposix4 reference.
gcc/ada:
* Makefile.rtl <sparc*-sun-solaris*> (THREADSLIB): Remove.
(MISCLIB): Remove -lposix4.
<*86-*-solaris2*>: Likewise.
* libgnarl/s-osinte__solaris.ads (System.OS_Interface): Remove
-lposix4 -lthread.
We only need to check that the constructor doesn't clear errno, so
there's no need to use an invalid FILE* for that.
libstdc++-v3/ChangeLog:
PR libstdc++/98001
* testsuite/ext/stdio_filebuf/char/79820.cc: Do not pass invalid
FILE* to constructor.
Due to the unexpected performance on Power9 of those vector
with length instructions, we didn't enable vectorization with
partial vectors before.
Some recent testings show that they perform expectedly on
Power10 now. This patch is to set
param_vect_partial_vector_usage as 1 for P10 or later.
The performance evaluation on the whole SPEC2017 with option
set power10/Ofast/unroll shows it can speed up 525.x264_r by
10.80% and 554.roms_r by 1.94%.
Bootstrapped/regtested on powerpc64le-linux-gnu P10.
gcc/ChangeLog:
* config/rs6000/rs6000.c (rs6000_option_override_internal):
Set param_vect_partial_vector_usage as 1 for Power10 and up
by default.
On Wed, Nov 25, 2020 at 12:26:17PM -0500, Jason Merrill wrote:
> I think you want to check DECL_PADDING_P here; the C and C++ front ends set
> it on unnamed bit-fields, and that's what is_empty_type looks at.
While the above has been written in the context of __builtin_bit_cast patch,
I think it applies to __builtin_clear_padding too.
So this patch implements that. The C FE sets DECL_PADDING_P solely on the
DECL_BIT_FIELD !DECL_NAME FIELD_DECLs, the C++ FE sets it on those and in
another spot I haven't really figured out what it is about.
2020-11-26 Jakub Jelinek <jakub@redhat.com>
* gimple-fold.c (clear_padding_union): Ignore DECL_PADDING_P
fields.
(clear_padding_type): Ignore DECL_PADDING_P fields, rather than
DECL_BIT_FIELD with NULL DECL_NAME.
My recent wide_int_binop changes caused ICE on this testcase.
The problem is that for shift where amount has MSB set now fails to optimize
into a constant (IMHO we should treat out of bounds shifts the same later),
but there is a precedent for that already - e.g. division by zero fails
to optimize into a constant too. I think it is better if path isolation
checks for these UBs and does something the user chooses (__builtin_trap vs.
__builtin_unreachable, and either a deferred warning about the UB or
nothing).
This patch just doesn't optimize if int_const_binop failed.
2020-11-26 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/97979
* match.pd ((X {&,^,|} C2) << C1 into (X << C1) {&,^,|} (C2 << C1)):
Only optimize if int_const_binop returned non-NULL.
* gcc.dg/pr97979.c: New test.
* gcc.c-torture/compile/pr97979.c: New test.
This makes sure not to free() memory we have mprotected to PROT_NONE
by calling mprotect again with PROT_READ|PROT_WRITE. This avoids
crashing the allocator when in debug mode.
2020-11-16 Richard Biener <rguenther@suse.de>
PR testsuite/98002
* gcc.dg/strncmp-2.c: Call mprotect again before free.
This fixes a GCC 11, 10, 9 regression introduced by commit
dfd7fdca2a (Subversion r267272) "C++: more
location wrapper nodes (PR c++/43064, PR c++/43486)". But: this isn't
intending to blame David, because back then, the problem hasn't been visible in
the testsuite (or else I'm sure would've been addressed right away) because of
our all dear friend: missing testsuite coverage. Thus, for GCC 8, I'm likewise
enhancing the testsuite, without the C++ front end code changes.
I actually had presumed that there may be an issue for OpenACC:
<http://mid.mail-archive.com/874lb9qr2u.fsf@euler.schwinge.homeip.net>, so here
we are, two years (and many "wasted" hours...) later...
gcc/cp/
* parser.c (cp_parser_omp_var_list_no_open): Assert that array
section's 'low_bound', 'length' are not location wrapper nodes.
(cp_parser_oacc_all_clauses, cp_parser_oacc_cache): Instantiate
'auto_suppress_location_wrappers'.
gcc/testsuite/
* c-c++-common/goacc/cache-3-1.c: New.
* c-c++-common/goacc/cache-3-2.c: Likewise.
* c-c++-common/goacc/data-clause-1.c: Likewise.
* c-c++-common/goacc/data-clause-2.c: Likewise.
* c-c++-common/gomp/map-1.c: Adjust.
* c-c++-common/gomp/map-2.c: Likewise.
* g++.dg/goacc/cache-3-1.C: New.
* g++.dg/goacc/cache-3-2.C: Likewise.
* g++.dg/goacc/data-clause-1.C: Likewise.
* g++.dg/goacc/data-clause-2.C: Likewise.
* g++.dg/gomp/map-1.C: Adjust.
* g++.dg/gomp/map-2.C: Likewise.
Reported-by: Sandra Loosemore <sandra@codesourcery.com>
Generate special double mode sequence also for QImode and HImode.
Without QImode and HImode patterns, middle-end extends operands to SImode
and emits SImode conditional move instruction with paradoxical SImode output
register. This form is not recognized by STV pass, but a single abs with
input operand in a register would not be converted anyway due to relatively
high register conversion cost.
2020-11-26 Uroš Bizjak <ubizjak@gmail.com>
PR target/97873
gcc/
* config/i386/i386.md (abs<mode>2): Use SDWIM mode iterator.
(*abs<mode>2_1): Use SWI mode iterator.
(<maxmin:code><mode>3): Use SDWIM mode iterator.
(*<maxmin:code><mode>3_1): Use SWI mode iterator.
gcc/testsuite/
* gcc.target/i386/pr97873-3.c: New test.
gcc/ada/
* sem_ch6.adb (Analyze_Call_And_Resolve): Add information to the
error message on an illegal procedure call, when the illegality
is due to the presence of a component of the full view of the
target object, as well as a procedure with the same name (See RM
4.1.3 (9.2/3)).
gcc/ada/
* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
when the restriction is a configuration pragma and specifies
No_Tasking, a global flag is set to reject task declarations,
and to prevent the construction of Master entities. The flag
must not be set if the pragma is a Restriction_Warning, in which
case task declarationns are allowed.
gcc/ada/
* libgnat/a-stzhas.adb (Wide_Wide_Hash): Instantiate inside a
wrapper function.
* libgnat/a-stzhas.ads (Wide_Wide_Hash): Likewise; remove wrong
comment, because this is indeed a RM unit, as described in Ada
RM A.4.8 (1/3).
gcc/ada/
* freeze.adb (Freeze_Array_Type): Remove propagation of
Has_Own_Invariants to the first subtype. This is a no-op,
because the current (incorrect) version of Has_Own_Invariants
calls Base_Type.
* sem_prag.adb, sem_util.adb: Pass the base type to
Set_Has_Own_Invariants.