News:

Download Pelles C here: http://www.pellesc.se

Main Menu

Recent posts

#71
Bug reports / Re: Calling cc with CreateProc...
Last post by Pelle - June 14, 2026, 09:13:32 PM
Thomas, I have already spent a fair amount of time investigating this problem. I'm still looking for a proper solution. This is going to take some time...
#72
Add-ins / Batch Builder
Last post by John Z - June 14, 2026, 02:49:41 AM
Add-In BBBBuilderPS.dll version 1.0  06/09/2026

The BBBBuilder.dll will create either a .bat file that when run from the command line will build the program that was open at the time BBBBuilder was invoked or a PowerShell .ps1 file which will do the same.

Essentially BBBBuilderPS creates a .bat or .ps1 file to perform a build similar to what cc does, but maybe easier . . .

Once built the batch file can be run at any time without using the IDE.
Source files can be added, removed or modified in the file lists, and then rebuild the program using the batch file.

It is a menu item BBBBuilder PS, under Project, below Workspace, and it is also a button on the toolbar (hammer & nail) :)

More information in the readme.txt file included with the sources -

John Z

Big Beautiful Batch Builder - one more B than Pres. Trump used  ;D  ;D  ;D

Note: This add-in is unrelated to the recently discovered cc issue, and was started long before it.
#73
Bug reports / Re: Segmentation fault with se...
Last post by MrBcx - May 30, 2026, 04:56:04 PM
Another observation:

If compiled to 32-bit:

In main
malloc successful
okay


If compiled to 64-bit:

In main
malloc successful
unhandled exception
#74
Bug reports / Re: Segmentation fault with se...
Last post by TimoVJL - May 30, 2026, 09:24:28 AM
An alignment error at memory for jmp_buf at x64

Simple test:
catch_type *pcs;
...
  catch_stack = (catch_type *)(malloc(max_catch_stack * sizeof(catch_type)+8));
  pcs = (catch_type *)(((long long)catch_stack) + ((long long)catch_stack % 16));
  printf("%p %p\n", catch_stack, pcs);
...
if ((fail_value = do_setjmp(pcs[catch_stack_pos])) == 0) {

Dynamic jmp_buf should allocated using aligned_alloc() function for x64.

Quote7.24.3 Memory management functions
1 The order and contiguity of storage allocated by successive calls to the aligned_alloc, calloc,
malloc, and realloc functions is unspecified. The pointer returned if the allocation succeeds is
suitably aligned so that it may be assigned to a pointer to any type of object with a fundamental
alignment requirement and size less than or equal to the size requested. It may then be used to
access such an object or an array of such objects in the space allocated (until the space is explicitly
deallocated).
#75
Bug reports / Segmentation fault with setjmp...
Last post by Thomas Mertes - May 30, 2026, 07:46:21 AM
If I compile and run the program below with gcc it writes:

In main
malloc successful
okay

Other C compilers have also no problem with this test program.
If I compile and run this test program with Pelles C it
triggers a segmentation fault after writing:

In main
malloc successful

This is the test program:

#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>

#define do_setjmp(jump_buf) setjmp(jump_buf)
typedef jmp_buf catch_type;
catch_type *catch_stack;
size_t catch_stack_pos;
size_t max_catch_stack;

int main (int argc, char **argv)
{
  int fail_value;
  catch_stack_pos = 0;
  max_catch_stack = 128;
  printf("In main\n");
  fflush(stdout);
  catch_stack = (catch_type *)(malloc(max_catch_stack * sizeof(catch_type)));
  if (catch_stack != NULL) {
    printf("malloc successful\n");
    fflush(stdout);
    if ((fail_value = do_setjmp(catch_stack[catch_stack_pos])) == 0) {
      printf("okay\n");
      fflush(stdout);
    }
  }
  return 0;
}
#76
Bug reports / Re: Calling cc with CreateProc...
Last post by TimoVJL - May 29, 2026, 12:24:00 PM
With Windows 7 x64.
C:\code\PellesC\_Forum>"C:\code\PellesC X\bin\cc.exe" "hello.c"
hello.c
fatal error #1061: Can't open input file 'X\bin\pocc.exe'.
#77
Bug reports / Re: Calling cc with CreateProc...
Last post by Michele - May 29, 2026, 09:49:25 AM
Thank you all for your support and for reminding us of the rules that should guide civil coexistence.
I made again an even simplest test from the command line. Writing the command:
"c:\Program Files\PellesC\Bin\cc.exe" /Go "test program.c"I get the error:
fatal error #1061: Can't open input file 'Files\PellesC\Bin\pocc.exe'.Feeding the same command to an utility that lists its arguments (replacing 'cc.exe' with the tool) the first line is correctly passed: "c:\Program Files\PellesC\Bin\listargs.exe".
So IMHO the bug is effective, when the 'cc' compiler driver parses the argv[0], to extract the origin directory to be used for the call of next compiler components, fails and stops at first white space.
OS WIN11
PellesC 14.10
#78
Bug reports / Re: Calling cc with CreateProc...
Last post by TimoVJL - May 29, 2026, 09:12:28 AM
What Windows OS version was used in failed tests ?
#79
Bug reports / Re: Calling cc with CreateProc...
Last post by MrBcx - May 29, 2026, 08:16:28 AM
Quote from: Thomas Mertes on May 29, 2026, 08:09:45 AMI apologize again for thinking that a human is a LLM.

I am sorry that I did that and that I reacted harshly.

I also admit that I am arrogant.

Many thanks to John Z for pointing out that I did something wrong.

Could we go back to the topic now?

The command line parsing of Pelles 'cc' does IMHO fail to parse argv[0] correctly.
It ignores that argv[0] has been quoted and ends argv[0] at the first space.
Beyond that it assigns the data after the space to argv[1].
This triggers errors like:

can't open input file 'Files\PellesC\Bin\pocc.exe'.

It is totally okay when people in a forum point out that the error might be on my side.
But in this case I am quite sure that the error is not on my side.

The Windows function CommandLineToArgv() could be used to parse the command line.
This would probably fix the problem. Other solutions are possible as well.

It would be nice if the command line parsing of Pelles 'cc' could be fixed.

Best regards
Thomas

Thomas,

As Pelles C is not open source and Pelle is the only person who can definitively address
your claims, I suggest that you ease up and wait for Pelle to chime in.  Like a number
of us old timers, I'm certain Pelle has a life outside of this project.  That said, Pelle
has a long history of taking bug reports seriously.  Patience is a virtue.


#80
Bug reports / Re: Calling cc with CreateProc...
Last post by Thomas Mertes - May 29, 2026, 08:09:45 AM
I apologize again for thinking that a human is a LLM.

I am sorry that I did that and that I reacted harshly.

I also admit that I am arrogant.

Many thanks to John Z for pointing out that I did something wrong.

Could we go back to the topic now?

The command line parsing of Pelles 'cc' does IMHO fail to parse argv[0] correctly.
It ignores that argv[0] has been quoted and ends argv[0] at the first space.
Beyond that it assigns the data after the space to argv[1].
This triggers errors like:

can't open input file 'Files\PellesC\Bin\pocc.exe'.

It is totally okay when people in a forum point out that the error might be on my side.
But in this case I am quite sure that the error is not on my side.

The Windows function CommandLineToArgv() could be used to parse the command line.
This would probably fix the problem. Other solutions are possible as well.

It would be nice if the command line parsing of Pelles 'cc' could be fixed.

Best regards
Thomas