bug-gnulib
[Top][All Lists]
Advanced

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

Re: Possible non-compliance of the restrict keyword contract in coreutil


From: Paul Eggert
Subject: Re: Possible non-compliance of the restrict keyword contract in coreutils/touch.c
Date: Wed, 27 Jul 2022 10:14:18 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

Thanks for the bug report. It's clearly a bug in 'touch'. I installed the attached patch into Coreutils master on Savannah.

It strikes me that the signatures for parse_datetime and parse_datetime2 could use more 'restrict's. For example, instead of this:

  bool parse_datetime (struct timespec *restrict,

                       char const *,
                       struct timespec const *);


gnulib/lib/parse-datetime.h should have this:

  bool parse_datetime (struct timespec *restrict,

                       char const *restrict,
                       struct timespec const *restrict);


This is the usual pattern in the C standard and POSIX; see strptime, for example[1]. Any reason not to make this change to Gnulib?

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html

Attachment: 0001-touch-fix-aliasing-bug.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]