llvm-mos / llvm-mos-sdk

SDK for developing with the llvm-mos compiler
https://www.llvm-mos.org
Other
266 stars 53 forks source link

fopen() causes premature exit on Commander X16 #346

Closed markjreed closed 1 month ago

markjreed commented 1 month ago

This program exits without returning from the fopen(), clearing the screen so that there's no message visible either. (If I comment out the fopen() call, the message displays and the infinite loop is entered as expected.)

#include <stdio.h>

int main() {
   FILE *fp;
   printf("About to call fopen():\n");
   fp = fopen("hello.txt", "w");
   for (;;)
       asm volatile("");
}

Built locally from git top-of-tree:

$ mos-cx16-clang --version 
clang version 19.0.0git (https://github.com/llvm-mos/llvm-mos 9bf5bd3e33c892b52d175321dad8c2da96bcab28)