https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89131
Bug ID: 89131 Summary: redundant -Wabsolute-value when -Wconversion is used and vice versa Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- The newly introduced -Wabsolute-value warning (also by -Wextra) partly duplicates the functionality of the -Wconversion warning (disabled by default). Enabling both options leads to duplicate diagnostics for the same problem, as the example below shows. Normally, to avoid drowning users in excessive complaints GCC tries to avoid issuing multiple warnings for the same construct, even if the warnings are slightly different (e.g., -Warray-bounds, -Wrestrict, and -Wstringop-overflow for basically the same bug). In this case, either this particular instance of -Wabsolute-value should be disabled when -Wconversion is enabled or (perhaps preferably), the other way around. $ cat u.c && gcc -S -Wall -Wextra -Wconversion u.c int f (long x) { return __builtin_abs (x); } u.c: In function ‘f’: u.c:3:10: warning: absolute value function ‘__builtin_abs’ given an argument of type ‘long int’ but has parameter of type ‘int’ which may cause truncation of value [-Wabsolute-value] 3 | return __builtin_abs (x); | ^~~~~~~~~~~~~ u.c:3:25: warning: conversion from ‘long int’ to ‘int’ may change value [-Wconversion] 3 | return __builtin_abs (x); | ^