I'm studying embedded systems and implementing a startup.c file from scratch. Upon creating the interrupt vector table, I get the following error on my editor (I'm using clangd as my LSP):
startup.c:
#include <stdint.h>
#define SRAM_START 0x20000000U
#define SRAM_SIZE (128U * 1024U)
#define SRAM_END ((SRAM_START) + (SRAM_SIZE))
#define STACK_START SRAM_END
int main(void);
void reset_handler(void);
/* more stuff */
uint32_t vectors[] __attribute__((section(".isr_vectors"))) = {
STACK_START,
(uint32_t)reset_handler,
/* more stuff */
}
void reset_handler(void){
/* .data, .text and .bss */
main();
}
Why is it that gcc allows this to compile?

He doesn't. Just make the vectors an array of function pointers.
The problem with OP code is the conversion from a function pointer
&reset_handlerto auint32_tvalue at(uint32_t)reset_handler,. Below, I present a smaller code example highlighting the problem:By changing the type of the array, the conversion is no longer needed, so it can be removed. By removing the code causing the error, the issue is solved.