Project

General

Profile

Bug #10413

SPARC needs some gcc7 fixes

Added by Peter Tribble 10 months ago.

Status:
New
Priority:
Normal
Assignee:
Category:
kernel
Start date:
2019-02-17
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

Adding gcc7 as a shadow on SPARC generates a number of errors, and then the build fails. Fixing these will then make more bugs accessible, of course.

../../sun4/os/cpu_states.c:188:3: error: this 'if' clause does not guard... [-Werror=misleading-indentation]

It's usr/src/uts/sun4/os/cpu_states.c

The indentation looks plain wrong.

../../sun4/os/trap.c:360:4: error: this statement may fall through [-Werror=implicit-fallthrough=]
../../sun4/os/trap.c:383:4: error: this statement may fall through [-Werror=implicit-fallthrough=]
../../sun4/os/trap.c:771:47: error: this statement may fall through [-Werror=implicit-fallthrough=]
../../sun4/os/trap.c:304:3: error: this statement may fall through [-Werror=implicit-fallthrough=]
case T_ALIGNMENT: /* supv alignment error */
../../sun4/os/trap.c:321:3: error: this statement may fall through [-Werror=implicit-fallthrough=]
../../sun4/os/trap.c:326:3: error: this statement may fall through [-Werror=implicit-fallthrough=]
../../sun4/os/trap.c:331:3: error: this statement may fall through [-Werror=implicit-fallthrough=]
../../sun4/os/trap.c:924:3: error: this statement may fall through [-Werror=implicit-fallthrough=]
../../sun4/os/trap.c:1061:3: error: this statement may fall through [-Werror=implicit-fallthrough=]

It's usr/src/uts/sun4/os/trap.c

Some are /*NOTREACHED*/, but that's lint, so just put in a break

line 770 is more interesting, fallthough is deliberate
What we need to do is put in the right magic comment for gcc to recognize

../../sparc/fs/proc/prmachdep.c:100:20: error: 'sizeof' on array function parameter 'prp' will return size of 'prgreg_t * {aka long int *}' [-Werror=sizeof-array-argument]
../../sparc/fs/proc/prmachdep.c:321:20: error: 'sizeof' on array function parameter 'prp' will return size of 'prgreg32_t * {aka int *}' [-Werror=sizeof-array-argument]

It's usr/src/uts/sparc/fs/proc/prmachdep.c

I think you call sizoef vs the typ, not the variable...

../../sun4/vm/vm_dep.h:418:19: error: left shift of negative value [-Werror=shift-negative-value]
../../sun4/vm/vm_dep.h:628:3: error: this statement may fall through [-Werror=implicit-fallthrough=]
../../sun4/vm/vm_dep.h:628:3: error: this statement may fall through [-Werror=implicit-fallthrough=]

It's usr/src/uts/sun4/vm/vm_dep.h

fallthrough use the magic value as it's deliberate
left shift, use ULONG_MAX rather than -1
(see 8396 which was the intel variant)

Also available in: Atom PDF