[Bug c/124968] New: tree-chrec.cc: 120: Possible cut'n'paste error ?
dcb314 at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Apr 21 15:44:29 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124968
Bug ID: 124968
Summary: tree-chrec.cc: 120: Possible cut'n'paste error ?
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Target Milestone: ---
Source code is
if (code == PLUS_EXPR || code == POINTER_PLUS_EXPR)
{
left = chrec_fold_plus
(type, CHREC_LEFT (poly0), CHREC_LEFT (poly1));
right = chrec_fold_plus
(rtype, CHREC_RIGHT (poly0), CHREC_RIGHT (poly1));
}
else
{
left = chrec_fold_minus
(type, CHREC_LEFT (poly0), CHREC_LEFT (poly1));
right = chrec_fold_minus
(type, CHREC_RIGHT (poly0), CHREC_RIGHT (poly1));
}
So there are 3 mentions of type as the first parameter
and only 1 mention of rtype. Looks suspicious to me.
git blame says:
5be014d5b728 gcc/tree-chrec.c (Andrew Pinski 2007-06-15 22:42:36 -0700
113) if (code == PLUS_EXPR || code == POINTER_PLUS_EXPR)
c8a2ab6d0cba gcc/tree-chrec.c (Sebastian Pop 2004-06-30 17:37:42 +0200
114) {
b8698a0f3794 gcc/tree-chrec.c (H.J. Lu 2009-11-25 10:55:54 +0000
115) left = chrec_fold_plus
c8a2ab6d0cba gcc/tree-chrec.c (Sebastian Pop 2004-06-30 17:37:42 +0200
116) (type, CHREC_LEFT (poly0), CHREC_LEFT (poly1));
b8698a0f3794 gcc/tree-chrec.c (H.J. Lu 2009-11-25 10:55:54 +0000
117) right = chrec_fold_plus
5be014d5b728 gcc/tree-chrec.c (Andrew Pinski 2007-06-15 22:42:36 -0700
118) (rtype, CHREC_RIGHT (poly0), CHREC_RIGHT (poly1));
c8a2ab6d0cba gcc/tree-chrec.c (Sebastian Pop 2004-06-30 17:37:42 +0200
119) }
c8a2ab6d0cba gcc/tree-chrec.c (Sebastian Pop 2004-06-30 17:37:42 +0200
120) else
c8a2ab6d0cba gcc/tree-chrec.c (Sebastian Pop 2004-06-30 17:37:42 +0200
121) {
b8698a0f3794 gcc/tree-chrec.c (H.J. Lu 2009-11-25 10:55:54 +0000
122) left = chrec_fold_minus
c8a2ab6d0cba gcc/tree-chrec.c (Sebastian Pop 2004-06-30 17:37:42 +0200
123) (type, CHREC_LEFT (poly0), CHREC_LEFT (poly1));
b8698a0f3794 gcc/tree-chrec.c (H.J. Lu 2009-11-25 10:55:54 +0000
124) right = chrec_fold_minus
c8a2ab6d0cba gcc/tree-chrec.c (Sebastian Pop 2004-06-30 17:37:42 +0200
125) (type, CHREC_RIGHT (poly0), CHREC_RIGHT (poly1));
c8a2ab6d0cba gcc/tree-chrec.c (Sebastian Pop 2004-06-30 17:37:42 +0200
126) }
In Coverity scan, CID 721811.
More information about the Gcc-bugs
mailing list