public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "guido at vanguardiasur dot com.ar" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/61050] New: OpenMP: wrong behavior of 'omp for' on corner cases Date: Sat, 03 May 2014 22:04:00 -0000 [thread overview] Message-ID: <bug-61050-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61050 Bug ID: 61050 Summary: OpenMP: wrong behavior of 'omp for' on corner cases Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: guido at vanguardiasur dot com.ar Created attachment 32728 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32728&action=edit example input Note: by infinite loop, we mean something of the form 'for (i=0; i>=0; i++)', not considering overflow. #pragma omp for changes the behavior of empty/infinite loops. Some empty loops are entered once per thread, and some infinite loops are either not entered at all or entered once. An example is attached and more are found in [1]. In the attached example, this loop: char i; #pragma omp for for (i=100; i<90; i--) printf("Hello %i %i\n", i, omp_get_thread_num()); is entered exactly once, with i = 100, when it should never be entered. There are no parallel directives. We believe this is caused by a miscalculation of the number of iterations, or a wrong empty loop check (or both). The calculated number of iterations (extracted from the assembly) for the previous example is 12, when it should probably be zero. Also, some loops give a negative loop count but are still entered (once). This happens on gcc 4.9.0, 4.8.2 and some older versions too. We've reproduced it easily. We checked the OpenMP specification and it does not mention an exception in these cases. Also note, this behavior does not seem to occur in fortran. gcc -v -save-temps output at http://sprunge.us/TfaC. [1] http://sprunge.us/TbWj http://sprunge.us/NCeA http://sprunge.us/PAZD http://sprunge.us/faTD http://sprunge.us/CIMN
next reply other threads:[~2014-05-03 22:04 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-05-03 22:04 guido at vanguardiasur dot com.ar [this message] 2014-05-04 5:53 ` [Bug c/61050] " jakub at gcc dot gnu.org 2014-05-04 21:52 ` guido at vanguardiasur dot com.ar
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-61050-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).