[Bug rtl-optimization/92107] New: GCC's insn attribute arithmetic does not follow C rules
meissner at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Oct 15 18:22:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92107
Bug ID: 92107
Summary: GCC's insn attribute arithmetic does not follow C
rules
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: meissner at gcc dot gnu.org
Target Milestone: ---
I was trying to adjust the length calculation in the PowerPC to deal with the
new prefixed addressing that a future machine will have.
I wanted to use a numeric insn attribute, and I wanted to do:
(attr + 1) * 4
(define_attr "length" ""
(mult (plus (attr "num_prefixed_insns")
(const_int 1))
(const_int 4)))
When I looked at the code in insn-attrtab.c, I noticed it did not have
parenthesis in it. I.e.:
get_attr_num_prefixed_insns (insn) + 1 * 4
when it should be:
(get_attr_num_prefixed_insns (insn) + 1) * 4
More information about the Gcc-bugs
mailing list