public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/33720] A negative value in OpenMP clause num_threads is not detected at runtime
       [not found] <bug-33720-4@http.gcc.gnu.org/bugzilla/>
@ 2013-06-19 18:19 ` geir at cray dot com
  2013-06-19 18:23 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: geir at cray dot com @ 2013-06-19 18:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33720

--- Comment #6 from Geir Johansen <geir at cray dot com> ---
Fails in GCC 4.8.0:

$ gcc --version
gcc (GCC) 4.8.0 20130322 (Cray Inc.)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc -o x -fopenmp bug2883.c -lm
$ ./x
pi       3.1416 n_thread -7

libgomp: Out of memory allocating 481036337712 bytes
$


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libgomp/33720] A negative value in OpenMP clause num_threads is not detected at runtime
       [not found] <bug-33720-4@http.gcc.gnu.org/bugzilla/>
  2013-06-19 18:19 ` [Bug libgomp/33720] A negative value in OpenMP clause num_threads is not detected at runtime geir at cray dot com
@ 2013-06-19 18:23 ` jakub at gcc dot gnu.org
  2013-06-19 20:45 ` manu at gcc dot gnu.org
  2021-12-29  7:54 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-06-19 18:23 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33720

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I still believe it is not needed to slow down the runtime library with checks
for invalid programs.  Negative num_threads is undefined behavior, just don't
do it.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libgomp/33720] A negative value in OpenMP clause num_threads is not detected at runtime
       [not found] <bug-33720-4@http.gcc.gnu.org/bugzilla/>
  2013-06-19 18:19 ` [Bug libgomp/33720] A negative value in OpenMP clause num_threads is not detected at runtime geir at cray dot com
  2013-06-19 18:23 ` jakub at gcc dot gnu.org
@ 2013-06-19 20:45 ` manu at gcc dot gnu.org
  2021-12-29  7:54 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu.org @ 2013-06-19 20:45 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 4302 bytes --]

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33720

--- Comment #8 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #7)
> I still believe it is not needed to slow down the runtime library with
> checks for invalid programs.  Negative num_threads is undefined behavior,
> just don't do it.

Perhaps the check could be added with the new -fsanitize=undefined?
>From gcc-bugs-return-424664-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jun 19 20:46:09 2013
Return-Path: <gcc-bugs-return-424664-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 26318 invoked by alias); 19 Jun 2013 20:46:09 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 26301 invoked by uid 48); 19 Jun 2013 20:46:06 -0000
From: "zsojka at seznam dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/57655] New: [4.8/4.9 Regression] ICE: in create_pre_exit, at mode-switching.c:418 with -mno-fp-ret-in-387 -mvzeroupper -mxop and __builtin_ilogbl()
Date: Wed, 19 Jun 2013 20:46:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: zsojka at seznam dot cz
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-57655-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-06/txt/msg01043.txt.bz2
Content-length: 2033

http://gcc.gnu.org/bugzilla/show_bug.cgi?idW655

            Bug ID: 57655
           Summary: [4.8/4.9 Regression] ICE: in create_pre_exit, at
                    mode-switching.c:418 with -mno-fp-ret-in-387
                    -mvzeroupper -mxop and __builtin_ilogbl()
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz

Created attachment 30324
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id0324&actioníit
reduced testcase

Compiler output:
$ gcc -mno-fp-ret-in-387 -mvzeroupper -mxop testcase.c
testcase.c: In function 'foo':
testcase.c:5:1: internal compiler error: in create_pre_exit, at
mode-switching.c:418
 }
 ^
0x1178ceb create_pre_exit
        /mnt/svn/gcc-trunk/gcc/mode-switching.c:404
0x1178ceb optimize_mode_switching
        /mnt/svn/gcc-trunk/gcc/mode-switching.c:493
0x1178ceb rest_of_handle_mode_switching
        /mnt/svn/gcc-trunk/gcc/mode-switching.c:779
0xc97d17 rest_of_handle_insert_vzeroupper
        /mnt/svn/gcc-trunk/gcc/config/i386/i386.c:2599
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

$ gcc -v
Using built-in specs.
COLLECT_GCC=/mnt/svn/gcc-trunk/binary-latest/bin/gcc
COLLECT_LTO_WRAPPER=/mnt/svn/gcc-trunk/binary-200176-lto-fortran-checking-yes-rtl-df/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /mnt/svn/gcc-trunk//configure --enable-checking=yes,rtl,df
--enable-languages=c,c++,lto,fortran
--prefix=/mnt/svn/gcc-trunk/binary-200176-lto-fortran-checking-yes-rtl-df/
--without-cloog --without-ppl
Thread model: posix
gcc version 4.9.0 20130618 (experimental) (GCC)

Tested revisions:
r200211 - ICE
4.8 r198018 - ICE
4.7 r198018 - OK


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libgomp/33720] A negative value in OpenMP clause num_threads is not detected at runtime
       [not found] <bug-33720-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2013-06-19 20:45 ` manu at gcc dot gnu.org
@ 2021-12-29  7:54 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-29  7:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33720

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-12-29

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libgomp/33720] A negative value in OpenMP clause num_threads is not detected at runtime
  2007-10-09 20:49 [Bug c/33720] New: A negative value in OpenMP clause num_threasds " geir at cray dot com
                   ` (2 preceding siblings ...)
  2009-07-31 15:12 ` manu at gcc dot gnu dot org
@ 2009-09-14 20:00 ` geir at cray dot com
  3 siblings, 0 replies; 8+ messages in thread
From: geir at cray dot com @ 2009-09-14 20:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from geir at cray dot com  2009-09-14 19:59 -------
(In reply to comment #4)
> Geir, have you run the testcase with other compilers? What is the result?
> 

Changed test cast to use 2 threads ("omp_set_num_threads(2);")

  PGI 9.0-3

$ pgcc -mp bug2883.c
$ ./a.out
pi       3.1416 n_thread -7
Error: omp_set_num_threads value (-7) is invalid
$

  Pathscale 3.2.99:

$ pathcc -mp bug2883.c
$ ./a.out
pi       3.1416 n_thread -7
actual_num_threads = 1
$

  Intel/11.1.046:

$ icc -openmp bug2883.c
$ ./a.out
pi       3.1416 n_thread -7
actual_num_threads = 2
$

  Cray 7.1.3:

$ cc -target=native bug2883.c
$ ./a.out
pi       3.1416 n_thread -7
actual_num_threads = 2
$

$


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33720


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libgomp/33720] A negative value in OpenMP clause num_threads is not detected at runtime
  2007-10-09 20:49 [Bug c/33720] New: A negative value in OpenMP clause num_threasds " geir at cray dot com
  2007-11-12 19:37 ` [Bug libgomp/33720] A negative value in OpenMP clause num_threads " jakub at gcc dot gnu dot org
  2008-08-07  2:56 ` manu at gcc dot gnu dot org
@ 2009-07-31 15:12 ` manu at gcc dot gnu dot org
  2009-09-14 20:00 ` geir at cray dot com
  3 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-07-31 15:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from manu at gcc dot gnu dot org  2009-07-31 15:11 -------
Geir, have you run the testcase with other compilers? What is the result?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33720


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libgomp/33720] A negative value in OpenMP clause num_threads is not detected at runtime
  2007-10-09 20:49 [Bug c/33720] New: A negative value in OpenMP clause num_threasds " geir at cray dot com
  2007-11-12 19:37 ` [Bug libgomp/33720] A negative value in OpenMP clause num_threads " jakub at gcc dot gnu dot org
@ 2008-08-07  2:56 ` manu at gcc dot gnu dot org
  2009-07-31 15:12 ` manu at gcc dot gnu dot org
  2009-09-14 20:00 ` geir at cray dot com
  3 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-08-07  2:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from manu at gcc dot gnu dot org  2008-08-07 02:55 -------
(In reply to comment #2)
> I'm not sure we should do anything about this.
> We have a warning if the compiler can detect non-positive value at compile
> time,
> but we certainly can't ever issue any diagnostic at runtime for num_threads
> 0 (because the implementation uses that value to mean no num_threads clause was
> present) and I'm not convinced the runtime library needs to be verbose to
> stderr.  So e.g. silently assuming just one thread is IMHO better than doing
> gomp_fatal in there.  You shouldn't expect any particular behavior from program
> which triggers undefined behavior.

But in this case the value is negative, not zero, and it seems that gomp_fatal
is already being called:

libgomp: Out of memory allocating 34359738400 bytes

It will be better to print the cause of that "out of memory" error, that is,
that the number of threads was negative.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org,
                   |                            |jakub at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33720


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libgomp/33720] A negative value in OpenMP clause num_threads is not detected at runtime
  2007-10-09 20:49 [Bug c/33720] New: A negative value in OpenMP clause num_threasds " geir at cray dot com
@ 2007-11-12 19:37 ` jakub at gcc dot gnu dot org
  2008-08-07  2:56 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-12 19:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2007-11-12 19:37 -------
I'm not sure we should do anything about this.
We have a warning if the compiler can detect non-positive value at compile
time,
but we certainly can't ever issue any diagnostic at runtime for num_threads
0 (because the implementation uses that value to mean no num_threads clause was
present) and I'm not convinced the runtime library needs to be verbose to
stderr.  So e.g. silently assuming just one thread is IMHO better than doing
gomp_fatal in there.  You shouldn't expect any particular behavior from program
which triggers undefined behavior.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33720


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-12-29  7:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-33720-4@http.gcc.gnu.org/bugzilla/>
2013-06-19 18:19 ` [Bug libgomp/33720] A negative value in OpenMP clause num_threads is not detected at runtime geir at cray dot com
2013-06-19 18:23 ` jakub at gcc dot gnu.org
2013-06-19 20:45 ` manu at gcc dot gnu.org
2021-12-29  7:54 ` pinskia at gcc dot gnu.org
2007-10-09 20:49 [Bug c/33720] New: A negative value in OpenMP clause num_threasds " geir at cray dot com
2007-11-12 19:37 ` [Bug libgomp/33720] A negative value in OpenMP clause num_threads " jakub at gcc dot gnu dot org
2008-08-07  2:56 ` manu at gcc dot gnu dot org
2009-07-31 15:12 ` manu at gcc dot gnu dot org
2009-09-14 20:00 ` geir at cray dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).