On Wed, May 29, 2019 at 04:42:14PM +0200, Thomas Schwinge wrote: > Any comments on my question, please? > > On Tue, 09 Apr 2019 17:51:46 +0200, I wrote: > > On Tue, 29 Nov 2016 17:47:08 -0800, Cesar Philippidis > > <ce...@codesourcery.com> wrote: > > > One notable difference between the trunk and gomp4 implementation of the > > > tile clause is that gomp4 errors on negative value tile arguments, > > > whereas trunk issues warnings. > > > > I'm picking up these changes, which have been posted a few times, and > > have been rejected (at least in their current incarnation) a few times, > > too. ;-\ > > > > > Is there a reason why the fortran FE > > > generally emits a warning, on say num_threads(-5), instead of an error? > > > > Same for the C/C++ front ends, which I'm looking into first. > > > > Jakub, is the reason that even if the user is clearly doing something > > "strage" there, the compiler doesn't have a problem to continue > > compilation for 'num_threads(-5)', so it just emits a warning, but for > > example for 'collapse(-5)' is has to stop with an error, because it can't > > continue compilation in that case? Or, is there a different reason for > > the many 'warning_at ([...], "[...] must be positive"' (C front end, for > > example), instead of using 'error_at' for these?
collapse has a constant expression argument and if the value is negative (or 0), then parsing doesn't make sense, so that case is clearly something where an error is in order. num_threads is an example of where the standard is not completely clear if it is or is not ok to reject compilation as opposed to just UB at runtime if that happens and no problem if that construct is never encoutered at runtime. Kind like a C++ difference between: void foo () { constexpr int a = __INT_MAX__ + 1; int b = __INT_MAX__ + 1; } where for a we need to error, but for b we just warn (by default, of course one can use -Werror). Jakub