https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104643
Will Schmidt <willschm at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bergner at gcc dot gnu.org, | |segher at gcc dot gnu.org, | |willschm at gcc dot gnu.org --- Comment #2 from Will Schmidt <willschm at gcc dot gnu.org> --- (In reply to David Binderman from comment #0) > Static analyser cppcheck says: > > 1. > > gcc/config/rs6000/driver-rs6000.cc:578:13: style: Variable 'cache' is > reassigned a value before the old one has been used. [redundantAssignment] > > Source code is > > cache = detect_caches_freebsd (); > /* FreeBSD PPC does not provide any cache information yet. */ > cache = ""; > > The function call looks pointless. > > 2. > > gcc/config/rs6000/driver-rs6000.cc:582:13: style: Variable 'cache' is > reassigned a value before the old one has been used. [redundantAssignment] There is a similar pattern for the __linux__ if/else path. #elif defined (__FreeBSD__) cache = detect_caches_freebsd (); /* FreeBSD PPC does not provide any cache information yet. */ cache = ""; #elif defined (__linux__) cache = detect_caches_linux (); /* PPC Linux does not provide any cache information yet. */ cache = ""; #else It looks like the __linux__ reassignment has been there for quite a while as well. when not overridden, the detect_caches_foo functions call describe_cache, which builds a string ala sprintf (l1size, "--param l1-cache-size=%u", l1_sizekb); sprintf (line, "--param l1-cache-line-size=%u", l1_line); sprintf (l2size, "--param l2-cache-size=%u", l2_sizekb); return concat (l1size, " ", line, " ", l2size, " ", NULL); We've obviously not noticed that the param values are no longer being set, for quite a while. Is there value in re-enabling this, or could this simply be removed? The other logic in detect_caches_linux() does set values for l1_sizekb and friends, based on the detected platform string, which has a special case for power6* or not. Possibly would need some touch-ups for processors later than power6.