After Jakub and Richi's suggestion of using the same representation
for tracking known bits as we do in CCP, I took a peek at the code and
realized there's a plethora of bit-tracking code there that we could
be sharing with range-ops. For example, the multiplication
optimizations are way better than what I had cobbled together. For
that matter, our maybe nonzero tracking as a whole has a lot of room
for improvement. Being the lazy ass that I am, I think we should just
use one code base (CCP's).
This patch provides a thin wrapper for converting the irange maybe
nonzero bits to what CCP requires, and uses that to call into
bit_value_binop(). I have so far converted the MULT_EXPR range-op
entry to use it, as the DIV_EXPR entry we have gets a case CCP doesn't
get so I'd like to contribute the enhancement to CCP before converting
over.
I'd like to use this approach with the dozen or so tree_code's that
are handled in CCP, thus saving us from having to implement any of
them :).
Early next season I'd like to change irange's internal representation
to a pair of value / mask, and start tracking all known bits. This
ties in nicely with our plan for tracking known set bits.
Perhaps if the stars align, we could merge the bit twiddling in CCP
into range-ops and have a central repository for it. That is, once we
make the switch to wide-ints, and assuming there are no performance
issues. Note that range-ops is our lowest level abstraction.
i.e. it's just the math, there's no GORI or ranger, or even the
concept of a symbolic or SSA.
gcc/ChangeLog:
* range-op.cc (irange_to_masked_value): New.
(update_known_bitmask): New.
(operator_mult::fold_range): Call update_known_bitmask.
The test pr105586.c fails on a big endian system when run in 32bit
mode. The failure occurs as the test case does not guard against
unsupported __int128.
2022-10-13 Surya Kumari Jangala <jskumari@linux.ibm.com>
gcc/testsuite/
PR testsuite/107171
* gcc.target/powerpc/pr105586.c: Guard against unsupported
__int128.
I've missed that this function needs to handle all the builtins that
are handled in can_test_argument_range.
The following patch does that. For many of the builtins (like acos, or
log) it is the same range regardless of the floating point type, but for
some (cosh, sinh, exp{,m1,2}) it is different for each format,
so I had to compute those ranges.
Note, seems the existing ranges were in some cases (e.g. for exp2)
the smallest in absolute value which results infinite result, in others
the largest which still results in finite result (but consistently so
for the IEEE single vs. double). I've followed that for IEEE half and
quad cases too, just am not sure why it was like that. I think
get_domain with true, false is open interval rather than closed
and the comments indicate that too, conservatively that is certainly
correct.
OT, with frange, perhaps we could DCE the calls unconditionally if
frange can prove we are in the domain range.
2022-11-08 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/107547
* tree-call-cdce.cc (get_no_error_domain): Handle CASE_FLT_FN_FLOATN_NX
of BUILT_IN_{ACOS,ASIN,ACOSH,ATANH,LOG,LOG2,LOG10,LOG1P}. Handle
BUILT_IN_{COSH,SINH,EXP,EXPM1,EXP2}F{16,32,64,128}.
* gcc.dg/pr107547.c: New test.
For integer vector comparisons without XOP before AVX512{F,VL} we are
constrained by only GT and EQ being supported in HW.
For GTU we play tricks to implement it using GT or unsigned saturating
subtraction, for LT/LTU we swap the operands and thus turn it into
GT/GTU. For LE/LEU we handle it by using GT/GTU and negating the
result and for GE/GEU by using GT/GTU on swapped operands and negating
the result.
If the second operand is a CONST_VECTOR, we can usually do better though,
we can avoid the negation. For LE/LEU cst by doing LT/LTU cst+1 (and
then cst+1 GT/GTU x) and for GE/GEU cst by doing GT/GTU cst-1, provided
there is no wrap-around on those cst+1 or cst-1.
GIMPLE canonicalizes x < cst to x <= cst-1 etc. (the rule is smaller
absolute value on constant), but only for scalars or uniform vectors,
so in some cases this undoes that canonicalization in order to avoid
the extra negation, but it handles also non-uniform constants.
E.g. with -mavx2 the testcase assembly difference is:
- movl $47, %eax
+ movl $48, %eax
vmovdqa %xmm0, %xmm1
vmovd %eax, %xmm0
vpbroadcastb %xmm0, %xmm0
- vpminsb %xmm0, %xmm1, %xmm0
- vpcmpeqb %xmm1, %xmm0, %xmm0
+ vpcmpgtb %xmm1, %xmm0, %xmm0
and
- vmovdqa %xmm0, %xmm1
- vmovdqa .LC1(%rip), %xmm0
- vpminsb %xmm1, %xmm0, %xmm1
- vpcmpeqb %xmm1, %xmm0, %xmm0
+ vpcmpgtb .LC1(%rip), %xmm0, %xmm0
while with just SSE2:
- pcmpgtb .LC0(%rip), %xmm0
- pxor %xmm1, %xmm1
- pcmpeqb %xmm1, %xmm0
+ movdqa %xmm0, %xmm1
+ movdqa .LC0(%rip), %xmm0
+ pcmpgtb %xmm1, %xmm0
and
- movdqa %xmm0, %xmm1
- movdqa .LC1(%rip), %xmm0
- pcmpgtb %xmm1, %xmm0
- pxor %xmm1, %xmm1
- pcmpeqb %xmm1, %xmm0
+ pcmpgtb .LC1(%rip), %xmm0
2022-11-08 Jakub Jelinek <jakub@redhat.com>
PR target/107546
* config/i386/predicates.md (vector_or_const_vector_operand): New
predicate.
* config/i386/sse.md (vec_cmp<mode><sseintvecmodelower>,
vec_cmpv2div2di, vec_cmpu<mode><sseintvecmodelower>,
vec_cmpuv2div2di): Use nonimmediate_or_const_vector_operand
predicate instead of nonimmediate_operand and
vector_or_const_vector_operand instead of vector_operand.
* config/i386/i386-expand.cc (ix86_expand_int_sse_cmp): For
LE/LEU or GE/GEU with CONST_VECTOR cop1 try to transform those
into LE/LEU or GT/GTU with larger or smaller by one cop1 if
there is no wrap-around. Force CONST_VECTOR cop0 or cop1 into
REG. Formatting fix.
* gcc.target/i386/pr107546.c: New test.
As r13-3609-g6d9dbdf51f9afe8 has been committed, we can now enable
even the denorm_min test.
2022-11-08 Jakub Jelinek <jakub@redhat.com>
* testsuite/20_util/to_chars/float128_c++23.cc (test): Uncomment
denorm_min test.
When the allocator is of an unconstrained array type and has an initializing
expression, the copy of the initializing expression must be done separately
from that of the bounds.
gcc/ada/
* gcc-interface/utils2.cc (build_allocator): For unconstrained
array types with a storage model and an initializing expression,
copy the initialization expression separately from the bounds. In
all cases with a storage model, pass the locally computed size for
the store.
In the case of Some_Enumeration_Type'Image (<some static value>),
the compiler will replace this expression in its internal program
representation with a corresponding string literal. This is incorrect
if the Put_Image aspect has been specified (directly or via inheritance)
for the enumeration type.
gcc/ada/
* sem_attr.adb
(Eval_Attribute): Don't simplify 'Image call if Put_Image has been
specified.
Before this patch, a classwide contract expression was preanalyzed
only when its primitive operation's type was frozen. It caused name
resolution to be off in the cases where the freezing took place
after the end of the declaration list the primitive operation was
declared in.
This patch makes it so that if the compiler gets to the end of
the declaration list before the type is frozen, it preanalyzes the
classwide contract expression, so that the names are resolved in the
right context.
gcc/ada/
* contracts.adb
(Preanalyze_Class_Conditions): New procedure.
(Preanalyze_Condition): Moved out from Merge_Class_Conditions in
order to be spec-visible.
* contracts.ads
(Preanalyze_Class_Conditions): New procedure.
* sem_prag.adb
(Analyze_Pre_Post_Condition_In_Decl_Part): Call
Preanalyze_Class_Conditions when necessary.
gcc/ada/
* libgnat/system-vxworks7-aarch64-rtp-smp.ads: Set
Support_Atomic_Primitives to True.
* libgnat/system-vxworks7-aarch64.ads: Set
Support_Atomic_Primitives to True.
* libgnat/system-vxworks7-arm-rtp-smp.ads: Set
Support_Atomic_Primitives to True.
* libgnat/system-vxworks7-arm.ads: Set Support_Atomic_Primitives
to True.
* libgnat/system-vxworks7-ppc-kernel.ads: Set
Support_Atomic_Primitives to False.
* libgnat/system-vxworks7-ppc-rtp-smp.ads: Set
Support_Atomic_Primitives to False.
* libgnat/system-vxworks7-ppc64-kernel.ads: Set
Support_Atomic_Primitives to True.
* libgnat/system-vxworks7-ppc64-rtp-smp.ads: Set
Support_Atomic_Primitives to True.
* libgnat/system-vxworks7-x86-kernel.ads: Set
Support_Atomic_Primitives to True.
* libgnat/system-vxworks7-x86-rtp-smp.ads: Set
Support_Atomic_Primitives to True.
* libgnat/system-vxworks7-x86_64-kernel.ads: Set
Support_Atomic_Primitives to True.
* libgnat/system-vxworks7-x86_64-rtp-smp.ads: Set
Support_Atomic_Primitives to True.
When instantiating generic package that includes a formal subprogram
declaration with Ghost aspect and a subprogram_default of null, e.g.:
generic
with procedure Proc is null with Ghost;
package P is ...
the Ghost aspect should be propagated to the internally generated null
subprogram, so this null subprogram can be used in contexts that require
ghost entities.
gcc/ada/
* sem_ch12.adb (Instantiate_Formal_Subprogram): Copy aspect Ghost
from formal subprogram declaration to the internally generated
procedure.
This rule deals with the specific case of a conditional expression that is
the operand of a type conversion and effectively distributes the conversion
to the dependent expressions with the help of the dynamic semantics.
gcc/ada/
* sem_ch4.adb (Analyze_Case_Expression): Compute the
interpretations of the expression only at the end of the analysis,
but skip doing it if it is the operand of a type conversion.
(Analyze_If_Expression): Likewise.
* sem_res.adb (Resolve): Deal specially with conditional
expression that is the operand of a type conversion.
(Resolve_Dependent_Expression): New procedure.
(Resolve_Case_Expression): Call Resolve_Dependent_Expression.
(Resolve_If_Expression): Likewise.
(Resolve_If_Expression.Apply_Check): Take result type as
parameter.
(Resolve_Type_Conversion): Do not warn about a redundant
conversion when the operand is a conditional expression.
This patch enforces matching of extra formals in overridden subprograms,
subprogram renamings, and subprograms to which attributes 'Access,
'Unchecked_Access, or 'Unrestricted_Access is applied (for these access
cases the subprogram is checked against its corresponding subprogram
type). This enforcement is an internal consistency check, not an
implementation of some language legality rule.
gcc/ada/
* debug.adb
(Debug_Flag_Underscore_XX): Switch -gnatd_X used temporarily to allow
disabling extra formal checks.
* exp_attr.adb
(Expand_N_Attribute_Reference [access types]): Add extra formals
to the subprogram referenced in the prefix of 'Unchecked_Access,
'Unrestricted_Access or 'Access; required to check that its extra
formals match the extra formals of the corresponding subprogram type.
* exp_ch3.adb
(Stream_Operation_OK): Declaration moved to the public part of the
package.
(Validate_Tagged_Type_Extra_Formals): New subprogram.
(Expand_Freeze_Record_Type): Improve the code that takes care of
adding the extra formals of dispatching primitives; extended to
add also the extra formals to renamings of dispatching primitives.
* exp_ch3.ads
(Stream_Operation_OK): Declaration moved from the package body.
* exp_ch6.adb
(Check_BIP_Actuals): Complete documentation.
(Has_BIP_Extra_Formal): Subprogram declaration moved to the public
part of the package. In addition, a parameter has been added to
disable an assertion that requires its use with frozen entities.
(Duplicate_Params_Without_Extra_Actuals): New subprogram.
(Check_Subprogram_Variant): Emit the call without duplicating the
extra formals since they will be added when the call is analyzed.
(Expand_Call_Helper): Ensure that the called subprogram has all its
extra formals, enforce assertion checking extra formals on thunks,
and mark calls from thunks as processed-BIP-calls to avoid adding
their extra formals twice.
(Is_Build_In_Place_Function): Return False for entities with foreign
convention.
(Is_Build_In_Place_Function_Call): Return True also for not BIP functions
that have BIP formals since the extra actuals are required.
(Make_Build_In_Place_Call_In_Object_Declaration): Occurrences of
Is_Return_Object replaced by the local variable Is_OK_Return_Object
that evaluates to False for scopes with foreign convention.
(Might_Have_Tasks): Fix check of class-wide limited record types.
(Needs_BIP_Task_Actuals): Remove assertion to allow calling this
function in more contexts; in addition it returns False for functions
returning objects with foreign convention.
(Needs_BIP_Finalization_Master): Likewise.
(Needs_BIP_Alloc_Form): Likewise.
(Validate_Subprogram_Calls): Check that the number of actuals (including
extra actuals) of calls in the subtree N match their corresponding
formals.
* exp_ch6.ads
(Has_BIP_Extra_Formal): Subprogram declaration moved to the public
part of the package. In addition, a parameter has been added to
disable an assertion that requires its use with frozen entities.
(Is_Build_In_Place_Function_Call): Complete documentation.
(Validate_Subprogram_Calls): Check that the number of actuals (including
extra actuals) of calls in the subtree N match their corresponding
formals.
* freeze.adb
(Check_Itype): Add extra formals to anonymous access subprogram itypes.
(Freeze_Expression): Improve code that disables the addition of extra
formals to functions with foreign convention.
(Check_Extra_Formals): Moved to package Sem_Ch6 as Extra_Formals_OK.
(Freeze_Subprogram): Add extra formals to non-dispatching subprograms.
* frontend.adb
(Frontend): Validate all the subprogram calls; it can be disabled using
switch -gnatd_X
* sem_ch3.adb
(Access_Subprogram_Declaration): Defer the addition of extra formals to
the freezing point so that we know the convention.
(Check_Anonymous_Access_Component): Likewise.
(Derive_Subprogram): Fix documentation.
* sem_ch6.adb
(Has_Reliable_Extra_Formals): New subprogram.
(Check_Anonymous_Return): Fix check of access to class-wide limited
record types.
(Check_Untagged_Equality): Placed in alphabetical order.
(Extra_Formals_OK): Subprogram moved from freeze.adb.
(Extra_Formals_Match_OK): New subprogram.
(Has_BIP_Formals): New subprogram.
(Has_Extra_Formals): New subprograms.
(Needs_Accessibility_Check_Extra): New subprogram.
(Parent_Subprogram): New subprogram.
(Add_Extra_Formal): Minor code cleanup.
(Create_Extra_Formals): Enforce matching extra formals on overridden
and aliased entities.
* sem_ch6.ads
(Extra_Formals_Match_OK): New subprogram.
(Extra_Formals_OK): Subprogram moved from freeze.adb.
* sem_eval.adb
(Compile_Time_Known_Value): Improve predicate to avoid assertion
failure; found working on this ticket; this change does not
affect the behavior of the compiler because this subprogram
has an exception handler that returns False when the assertion
fails.
* sem_util.adb
(Needs_Result_Accessibility_Level): Do not return False for dispatching
operations compiled with Ada_Version < 2012 since they they may be
overridden by primitives compiled with Ada_Version >= Ada_2012.
This patch prepares to move warning switches from Opt into Warnsw.
gcc/ada/
* warnsw.ads, warnsw.adb, fe.h, err_vars.ads, errout.ads: Move
Warning_Doc_Switch from Err_Vars to Warnsw. Access
Warn_On_Questionable_Layout on the C side via a function rather
than a variable, because we plan to turn the variables into
renamings, and you can't Export renamings.
* erroutc.adb, switch-c.adb, errout.adb: Likewise.
* gcc-interface/decl.cc: Use Get_Warn_On_Questionable_Layout
instead of Warn_On_Questionable_Layout.
* gcc-interface/Makefile.in (GNATMAKE_OBJS): Add warnsw.o, because
it is indirectly imported via Errout.
* gcc-interface/Make-lang.in (GNATBIND_OBJS): Likewise and remove
restrict.o (not needed).
Shortly after the -gnatwc flag was introduced, its behavior was
tweaked, but its documentation was not updated accordingly.
gcc/ada/
* doc/gnat_ugn/building_executable_programs_with_gnat.rst
(-gnatwc): Fix flag documentation.
* gnat_ugn.texi: Regenerate.
In some cases where a declare expression occurs in a deferred-freezing
context (e.g., within the default value for a discriminant or for a formal
parameter, or within the expression of an expression function), the compiler
generates a bugbox.
gcc/ada/
* sem_ch3.adb
(Analyze_Object_Declaration): Do not perform expansion actions if
In_Spec_Expression is true.
This ensures that, during the analysis of the qualified expressions, type
conversions and unchecked type conversions, the determination of the type
of the node and the analysis of its expression are done in the same order.
No functional changes.
gcc/ada/
* sem_ch4.adb (Analyze_Qualified_Expression): Analyze the
expression only after setting the type.
(Analyze_Unchecked_Type_Conversion): Likewise.
(Analyze_Short_Circuit): Likewise for the operands.
(Analyze_Type_Conversion): Minor tweaks.
(Analyze_Unchecked_Expression): Likewise.
Classwide contracts are "spec expressions" as defined in the
documentation in sem.ads. Before this patch, the instances of
classwide contracts that are destined to class conditions merging
were not preanalyzed as spec expressions. That caused preanalysis to
emit spurious errors in some cases.
gcc/ada/
* contracts.adb (Preanalyze_Condition): Use
Preanalyze_Spec_Expression.
Attributes Wide_Image and Wide_Wide_Image applied to composite types are
now expanded just like attribute Image.
gcc/ada/
* exp_imgv.adb
(Expand_Wide_Image_Attribute): Handle just like attribute Image.
(Expand_Wide_Wide_Image_Attribute): Likewise.
* exp_put_image.adb
(Build_Image_Call): Adapt to also work for Wide and Wide_Wide
attributes.
* exp_put_image.ads
(Build_Image_Call): Update comment.
* rtsfind.ads
(RE_Id): Support wide variants of Get.
(RE_Unit_Table): Likewise.
Unneeded code found while experimenting with improved detection of
unreferenced objects.
gcc/ada/
* sem_ch12.adb (Validate_Formal_Type_Default): Remove call to
Collect_Interfaces, which had no effect apart from populating a
list that was not used; fix style.
Minor improvements; found experimenting with improved detection of
unreferenced objects.
gcc/ada/
* exp_spark.adb (SPARK_Freeze_Type): Refine type of a local
object.
* sem_ch3.adb (Derive_Subprograms): Remove initial value for
New_Subp, which is in only written as an out parameter and never
read.
For array delta aggregates the base expression cannot be limited; for
record delta aggregates the base expression can only be limited if it is
a newly constructed object.
gcc/ada/
* sem_aggr.adb (Resolve_Delta_Aggregate): Implement rules related
to limited objects appearing as the base expression.
Objects of a limited type can be initialized with "aggregates", which is
a collective term for ordinary aggregates (i.e. record aggregates and
array aggregates), extension aggregates and finally for delta
aggregates (introduced by Ada 2022).
gcc/ada/
* sem_ch3.adb (OK_For_Limited_Init_In_05): Handle delta aggregates
just like other aggregates.
Implement a missing check related to record delta aggregates.
gcc/ada/
* sem_aggr.adb (Resolve_Delta_Record_Aggregate): Reject
expressions of a limited types.
Implement missing behavior of RM 13.9 (25.1/3): Tag_Error is raised by a
call of Interface_Ancestor_Tags and Is_Descendant_At_Same_Level, if any
tag passed is No_Tag. This change also fixes Descendant_Tag, which
relies on Is_Descendant_At_Same_Level. The remaining operations already
worked properly.
gcc/ada/
* libgnat/a-tags.adb
(Interface_Ancestor_Tags): Raise Tag_Error on No_Tag.
(Is_Descendant_At_Same_Level): Likewise.
This fixes a spurious comma before the list of authors in the PDF
version of the libstdc++ manual.
Also fix the commented-out examples which should show <personblurb> not
<authorblurb>.
libstdc++-v3/ChangeLog:
* doc/xml/authors.xml: Remove empty author element.
* doc/xml/manual/spine.xml: Likewise.
* doc/html/manual/index.html: Regenerate.
This makes some followup code much cleaner.
gcc/analyzer/ChangeLog:
* call-info.cc (success_call_info::get_desc): Delete.
(failed_call_info::get_desc): Likewise.
(succeed_or_fail_call_info::get_desc): New.
* call-info.h (class succeed_or_fail_call_info): New.
(class success_call_info): Convert to a subclass of
succeed_or_fail_call_info.
(class failed_call_info): Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Tweak analyzer handling of strchr, so that we show the
when 'strchr' returns non-NULL
message for that execution path.
gcc/analyzer/ChangeLog:
* region-model-impl-calls.cc (region_model::impl_call_strchr):
Move to on_call_post. Handle both outcomes using bifurcation,
rather than just the "not found" case.
* region-model.cc (region_model::on_call_pre): Move
BUILT_IN_STRCHR and "strchr" to...
(region_model::on_call_post): ...here.
gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/strchr-1.c (test_literal): Detect writing to a
string literal. Verify that we emit the "when '__builtin_strchr'
returns non-NULL" message.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
This paper is resolving the problem of well-formed C++17 code becoming
ambiguous in C++20 due to asymmetrical operator== being compared with itself
in reverse. I had previously implemented a tiebreaker such that if the two
candidates were functions with the same parameter types, we would prefer the
non-reversed candidate. But the committee went with a different approach:
if there's an operator!= with the same parameter types as the operator==,
don't consider the reversed form of the ==.
So this patch implements that, and changes my old tiebreaker to give a
pedwarn if it is used. I also noticed that we were giving duplicate errors
for some testcases, and fixed the tourney logic to avoid that.
As a result, a lot of tests of the form
struct A { bool operator==(const A&); };
need to be fixed to add a const function-cv-qualifier, e.g.
struct A { bool operator==(const A&) const; };
The committee thought such code ought to be fixed, so breaking it was fine.
18_support/comparisons/algorithms/fallback.cc also breaks with this patch,
because of the similarly asymmetrical
bool operator==(const S&, S&) { return true; }
As a result, some of the asserts need to be reversed.
The H test in spaceship-eq15.C is specified in the standard to be
well-formed because the op!= in the inline namespace is not found by the
search, but that seems wrong to me. I've implemented that behavior, but
disabled it for now; if we decide that is the way we want to go, we can just
remove the "0 &&" in add_candidates to enable it.
Co-authored-by: Jakub Jelinek <jakub@redhat.com>
gcc/cp/ChangeLog:
* cp-tree.h (fns_correspond): Declare.
* decl.cc (fns_correspond): New.
* call.cc (add_candidates): Look for op!= matching op==.
(joust): Complain about non-standard reversed tiebreaker.
(tourney): Fix champ_compared_to_predecessor logic.
(build_new_op): Don't complain about error_mark_node not having
'bool' type.
* pt.cc (tsubst_copy_and_build): Don't try to be permissive
when seen_error().
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/spaceship-eq15.C: New test.
* g++.dg/cpp0x/defaulted3.C: Add const.
* g++.dg/cpp2a/bit-cast7.C: Add const.
* g++.dg/cpp2a/spaceship-rewrite1.C: Expect error.
* g++.dg/cpp2a/spaceship-rewrite5.C: Expect error.
* g++.old-deja/g++.jason/byval2.C: Expect error.
* g++.old-deja/g++.other/overload13.C: Add const.
libstdc++-v3/ChangeLog:
* testsuite/18_support/comparisons/algorithms/fallback.cc: Adjust
asserts.
Rewalk statements at the end of a block to see if any inferred ranges
affect earlier calculations and register those as inferred ranges.
gcc/
PR tree-optimization/104530
* gimple-range-cache.cc (ranger_cache::register_inferred_value):
New. Split from:
(ranger_cache::apply_inferred_ranges): Move setting cache to
separate function.
* gimple-range-cache.h (register_inferred_value): New prototype.
* gimple-range-infer.cc (infer_range_manager::has_range_p): New.
* gimple-range-infer.h (has_range_p): New prototype.
* gimple-range.cc (register_transitive_inferred_ranges): New.
* gimple-range.h (register_transitive_inferred_ranges): New proto.
* tree-vrp.cc (rvrp_folder::fold_stmt): Check for transitive inferred
ranges at the end of the block before folding final stmt.
gcc/testsuite/
* gcc.dg/pr104530.c: New.
On Mon, Nov 07, 2022 at 05:48:42PM +0000, Jonathan Wakely wrote:
> On Mon, 7 Nov 2022 at 16:11, Joseph Myers <joseph@codesourcery.com> wrote:
> >
> > On Wed, 2 Nov 2022, Jakub Jelinek via Gcc-patches wrote:
> >
> > > APIs. So that one can build gcc against older glibc and then compile
> > > user programs on newer glibc, the patch uses weak references unless
> > > gcc is compiled against glibc 2.26+. strfromf128 unfortunately can't
> >
> > This support for older glibc doesn't actually seem to be working, on an
> > older system with glibc 2.19 I'm seeing
> >
> > /scratch/jmyers/fsf/gcc-mainline/libstdc++-v3/src/c++17/floating_to_chars.cc:52:3: error: expected initializer before '__asm'
> > 52 | __asm ("strfromf128");
> > | ^~~~~
> >
> > and a series of subsequent errors.
>
> This seems to "fix" it (not sure if it's right though):
>
> #ifndef _GLIBCXX_HAVE_FLOAT128_MATH
> extern "C" _Float128 __strtof128(const char*, char**)
> __attribute__((__weak__));
> #endif
> extern "C" _Float128 __strtof128(const char*, char**)
> __asm ("strtof128");
It is, but floating_from_chars.cc has the same problem,
and I think we can avoid the duplication, like this:
2022-11-08 Jakub Jelinek <jakub@redhat.com>
PR libstdc++/107562
* src/c++17/floating_from_chars.cc (__strtof128): Put __asm before
__attribute__.
* src/c++17/floating_to_chars.cc (__strfromf128): Likewise.
Commit 068baae186 "bpf: add preserve_field_info builtin" factored out
some repeated code to a new function maybe_make_core_relo (), but missed
using it in one place. Clean that up.
gcc/
* config/bpf/bpf.cc (handle_attr_preserve): Use maybe_make_core_relo().
For unsigned numbers, multiplication by X, where X is a power of 2 is
[0,0][X,+INF].
This patch causes a regression to g++.dg/pr71488.C where
-Wstringop-overflow gets the same IL as before, but better ranges
cause it to issue a bogus warning. I will create a PR with some
notes.
No discernible changes in performance.
Tested on x86-64 Linux.
PR tree-optimization/55157
gcc/ChangeLog:
* range-op.cc (operator_mult::wi_fold): Optimize multiplications
by powers of 2.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr55157.c: New test.