unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: ". shynur" <one.last.kiss@outlook.com>
Cc: 67711@debbugs.gnu.org
Subject: bug#67711: Org Babel gives incomplete result when writing multi-thread code
Date: Fri, 08 Dec 2023 16:47:14 +0200	[thread overview]
Message-ID: <83lea4zr7x.fsf@gnu.org> (raw)
In-Reply-To: <PH0PR11MB74700E62F748DB32FC93FA4AD78AA@PH0PR11MB7470.namprd11.prod.outlook.com> (one.last.kiss@outlook.com)

> From: ". shynur" <one.last.kiss@outlook.com>
> Date: Fri, 8 Dec 2023 14:31:37 +0000
> msip_labels: 
> 
> (I use Emacs v29.1.90 for MS-Windows; gcc 10.3.0)
> Here's an Org file:
> 
>     #+BEGIN_SRC C
>     #include <stdio.h>
>     #include <omp.h>
>     int main() {
>     #pragma omp parallel num_threads(3)
>         printf("0"), printf("1");
>     }
>     #+END_SRC
> 
>     # Local Variables:
>     # eval: (require 'ob-C)
>     # org-babel-C-compiler: "gcc.exe  \
>     #                         -std=c17 -Wall -O0  \
>     #                         -fopenmp "
>     # org-confirm-babel-evaluate: nil
>     # End:
> 
> Executing the C code block usually outputs:
> 
>     #+RESULTS:
>     : 10101
> 
>     #+RESULTS:
>     : 1101
> 
> This output was unexpected, so I personally ran the temporary EXE file generated by Org-Babel:
> 
>     Windows Terminal
>     PS D:/Tmp/babel-Xyz123> ./C-bin-Xyz123.exe
>     010101
> 
> As you can see, this program should output 6 characters.

The above invocation is AFAIU not an accurate reproduction of what
happens when this program is invoked from Emacs on MS-Windows.  Emacs
on Windows communicates with subprocesses via pipes, so a more
accurate reproduction would be something like

   C-bin-Xyz123.exe | more

IOW, you need to invoke the program with its output redirected to a
pipe.

In any case, please report this to the Org developers first, and only
if their analysis shows this is a core Emacs problem, come here.

Thanks.





  parent reply	other threads:[~2023-12-08 14:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08 14:31 bug#67711: Org Babel gives incomplete result when writing multi-thread code . shynur
     [not found] ` <handler.67711.B.170204622920669.ack@debbugs.gnu.org>
2023-12-08 14:45   ` bug#67711: Org Babel gives incomplete result . shynur
2023-12-08 14:48     ` Eli Zaretskii
2023-12-08 14:47 ` Eli Zaretskii [this message]
2023-12-08 14:56   ` bug#67711: . shynur
2023-12-08 16:23     ` bug#67711: Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83lea4zr7x.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=67711@debbugs.gnu.org \
    --cc=one.last.kiss@outlook.com \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).