News:

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

Main Menu

Recent posts

#81
Announcements / Re: Release Candidate #1 for v...
Last post by John Z - March 16, 2026, 12:57:35 PM
Quote from: Pelle on March 15, 2026, 06:39:56 PMSee https://www.pellesc.se/, Download and Changes.


Thanks very much!

John Z

P.S. ARM64 will be a good challenge as will finding testers. I think currently a general population of users is a few percent, for high end systems it is reportedly approaching 10% mainly due to high performance snapdragon systems.  AI supplied numbers  :(  Of course that neglects about 1 billion device in phones . . . .
#82
Bug reports / Re: bug report. setvbuf() func...
Last post by John Z - March 16, 2026, 12:09:50 PM
Thanks Pelle!

👍👍👍

John Z
#83
Announcements / Re: Release Candidate #1 for v...
Last post by Pelle - March 16, 2026, 10:07:35 AM
Well, the movbe instruction is rather old. Hard to find the complete history and origin, but possibly from ~2013.
I have hold back some progress for years, due to certain old processors, but I'm getting fed up with that. In a perfect world I rather drop X86/X64 and move permanently to ARM64. Or better yet: find another project to waste time on. We'll see...
#84
Announcements / Re: Release Candidate #1 for v...
Last post by Vortex - March 15, 2026, 10:08:07 PM
Hi Pelle,

Thanks for the new release. Poide is crashing on Windows 7 Sp1.
#85
Announcements / Re: Release Candidate #1 for v...
Last post by TimoVJL - March 15, 2026, 09:57:54 PM
Thanks for new version for testing.

Windows 7 SP1 with an old AMD CPU without MOVBE:

poide crash
ModLoad: 00000001`3f7c0000 00000001`3fb5c000   poide.exe
...
ModLoad: 000007fe`e2bc0000 000007fe`e2bec000   C:\code\PellesC14rc1\Bin\Wizards64\wininst.dll
(8964.84dc): Illegal instruction - code c000001d (first chance)
(8964.84dc): Unknown exception - code c000041d (!!! second chance !!!)
*** WARNING: Unable to verify checksum for poide.exe
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for poide.exe -
poide!WizScanForDependenciesA+0xe2846:
00000001`3f293d46 660f38f1442430  movbe   word ptr [rsp+30h],ax ss:00000000`009eebd0=0000

polink crash
ModLoad: 00000001`3f8f0000 00000001`3f935000   image00000001`3f8f0000

...
(8958.8a30): Illegal instruction - code c000001d (first chance)
(8958.8a30): Illegal instruction - code c000001d (!!! second chance !!!)
*** WARNING: Unable to verify checksum for image00000001`3f8f0000
*** ERROR: Module load completed but symbols could not be loaded for image00000001`3f8f0000
image00000001_3f8f0000+0x1984:
00000001`3f8f1984 0f38f14608      movbe   dword ptr [rsi+8],eax ds:00000000`00222220=baadf00d
polib fail
Building zlib.lib.
POLIB: fatal error: An internal error occurred.

https://uops.info/html-instr/MOVBE_R32_M32.html

Incompatible CPU
AMD Athlon(tm) II X2 220 Processor
Intel Core i5-2450M CPU


https://en.wikipedia.org/wiki/Jaguar_(microarchitecture)

Not sure, if this detect MOVBE
#include <intrin.h>

void __cdecl exit(int status);
int printf(const char * restrict format, ...);

#pragma comment(lib, "msvcrt.lib")
//#pragma comment(linker,"/subsystem:console,5.1")
void __cdecl mainCRTStartup(void)
{
    int __cdecl main(void);
    void __cdecl exit(int status);
    exit(main());
}

// CPUID.(EAX=01H, ECX=0H):ECX.MOVBE[bit 22]
// EAX, EBX, ECX and EDX
//  0,   1,   2,      3
int GetCPUFeature(void)
{
    int r[4];    // EAX, EBX, ECX and EDX
    int rc = 0;
    _cpuid(r, 0);    // Highest Function Parameter and Manufacturer ID
    if (r[0] != 0x500) {    //
        _cpuid(r, 1);    // Processor Info and Feature Bits
        rc = _bittest((const long int *)&r[2], 22);

    }

    return rc;
}

int main(void)
{
    printf("CPU options: %d\n", GetCPUFeature());
    exit(0);
}
#86
Announcements / Release Candidate #1 for versi...
Last post by Pelle - March 15, 2026, 06:39:56 PM
See https://www.pellesc.se/, Download and Changes.
#87
Bug reports / Re: bug report. setvbuf() func...
Last post by Pelle - March 15, 2026, 11:45:36 AM
In the low-I/O C runtime function _write(), when operating in text mode (ANSI/UTF-16LE/UTF-8/...), there is a ~2kB buffer for LF to CRLF translation. When this buffer is full, the content is sent to the destination (console/file/...), the buffer cleared, and the translation resumed. When resuming the translation the first character was lost (in translation).

( The printf family is one path to the _write() function )
#88
Bug reports / Re: stdckdint.h bug report
Last post by Pelle - March 15, 2026, 11:32:37 AM
I think ckd_<op>() came more or less straight from GCC to the C23 standard, and like some other GCC "innovations" it's a bit over-worked / under-thinked.

I will revise my initial implementation slightly, mostly just to reject more bogus cases -- like the original bug report.
#89
Beginner questions / same code pelles c and gcc got...
Last post by ander_cc - March 15, 2026, 11:30:22 AM
#include <stdio.h>
#include <stdbit.h>
int main() {
    unsigned short a1 = 4;
unsigned int a2 = 4;

printf("a1 one:%u  a1 zero:%u\n", stdc_first_leading_one(a1), stdc_first_leading_zero(a1));
printf("a2 one:%u  a2 zero:%u\n", stdc_first_leading_one(a2), stdc_first_leading_zero(a2));
   
    return 0;
}
gcc 11.4 -std=c23
a1 one:14  a1 zero:1
a2 one:30  a2 zero:1
-----
pelles c 13.01
a1 one:3  a1 zero:16
a2 one:3  a2 zero:32
-----
WHY? and which is right?
#90
Bug reports / Re: O_BINARY
Last post by Pelle - March 15, 2026, 11:24:11 AM
This is more about policy, I think. I document only the header file where the function prototype is located, because that was easy to start with.

Some functions will "need" more header files, some functions will need a #define <symbol> before the #include <...> to activate the prototype, but with over 1000 pages in the "C runtime" folder (not all of them related to functions, but anyway) it's a bit hard to find the energy just to begin investigating what to update (and how)...