This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] Fix tree-optimization/49963


Hi,

I prepared the below basing on an hint provided by Joseph on the audit trail: essentially, I'm replacing all (but two) uses of abs_hwi outside hwint.c by absu_hwi, a variant which returns an unsigned HOST_WIDE_INT. All the replacements make sense to me: either we are comparing two abs, or we are passing the abs to a function actually expecting an unsigned HOST_WIDE_INT, or we are comparing to another unsigned HOST_WIDE_INT, or we are just comparing to a constant (I don't feel strongly in this case but seems safe to use absu_hwi here too). I'm *not* replacing 2 occurrences in gimple_expand_builtin_pow, because those are safe anyway in terms of range of the argument (it's an HOST_WIDE_INT / 2 or 3) and the result is passed to a function expecting a plain HOST_WIDE_INT (ie, gimple_expand_builtin_powi).

I sanity checked the patch on x86_64-linux and OP reported that on AVR the patch fixes the regression.

Is it ok?

Thanks,
Paolo.

PS: compared to the draft version, the attached uses cast to unsigned in both arms of the ? : operator, I think Joseph preferred that stylistically in a snippet of him posted in an unrelated recent audit trail.

///////////////////////////

Attachment: CL_49963
Description: Text document

Attachment: patch_49963
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]