[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#889821: [gcc] gcc 7 and 8 error message on restrict-qualified parameter refers to wrong parameter



Package: gcc
Version: 4:7.2.0-1d1
Severity: normal

--- Please enter the report below this line. ---

When a function pointer is restrict-qualified, GCC gives an error
message. However, when thishappens in a parameter list, gcc incorrectly
reports the error at the first restrict-qualified parameter, even if the
problem is at a different restrict-qaulified parameter. I tried with
both gcc 7.2.0 and gcc 8.0.0 from Debian.

Code to reproduce:

struct cvu_huffman_state
{
	unsigned char (*input)(void);
};

void cvu_init_huffman(struct cvu_huffman_state *restrict state, unsigned
char(*restrict input)(void))
{
	state->input = input;
}

The error message "error: invalid use of ‘restrict’" will report the
error at the first parameter, even though the problem is at the second
parameter.

Philipop

--- System information. ---
Architecture: Kernel:       Linux 4.14.0-2-amd64

Debian Release: buster/sid
  500 unstable        ftp.de.debian.org   500 testing
ftp.de.debian.org     1 experimental    ftp.de.debian.org
--- Package information. ---
Depends            (Version) | Installed
============================-+-=================
cpp         (>= 4:7.2.0-1d1) | 4:7.2.0-1d1
gcc-7          (>= 7.2.0-1~) | 7.2.0-19


Recommends      (Version) | Installed
=========================-+-===========
libc6-dev                 | 2.26-4
 OR libc-dev              |

Suggests          (Version) | Installed
===========================-+-===========
gcc-multilib                | make                        | 4.1-9.1
manpages-dev                | 4.14-1
autoconf                    | 2.69-11
automake                    | 1:1.15.1-3
libtool                     | 2.4.6-2
flex                        | 2.6.1-1.3
bison                       | 2:3.0.4.dfsg-1+b1
gdb                         | 7.12-6+b1
gcc-doc                     | 5:7.2.0-1


Reply to: