abs on unsigned value

Bug #1413108 reported by dcb on 2015-01-21
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Arch Linux

Bug Description warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]


The difference of two unsigneds is unsigned.

If RefPitch_wt < AbsPitch_wt, then wraparound to a large unsigned integer will occur.

Suggest code rework.

Stefan Husmann (stefan-husmann) wrote :

Gcc 7 changes the way abs is handled.

The attached patch at least makes rumor build again.

Václav Šmilauer (eudoxos) wrote :

Hi Stefan, thank you for the patch. I did not see the bgus reported here for quite some time. I will apply it soon. Cheers! Vaclav

Václav Šmilauer (eudoxos) wrote :

I fixed this in the last commit, by casting unsigned operands to signed. If you only remove the abs, then it compiles but changes functionality.

Changed in rumor:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers