Incidencia #40502

gcc on msys2 the compiler is failing

Abrir Fecha: 2020-06-24 05:26 Última actualización: 2020-06-24 07:14

Informador:
Propietario:
(Ninguno)
Tipo:
Estado:
Cerrado
Componente:
Prioridad:
8
Gravedad:
5 - Medium
Resolución:
Invalid
Fichero:
Ninguno
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Details

When I use gcc on MSYS2 Package

Installation: pacman -S mingw-w64-x86_64-gcc Version: 10.1.0-3 Build Date: 2020-06-01 11:25:47

ld -v: GNU ld (GNU Binutils) 2.34 MINGW64_NT-10.0-18362 Fx 3.1.5-340.x86_64 2020-06-06 09:16 UTC x86_64 Msys

I get a problem from this sample code:


  1. // myproject.c
  2. #include <stdio.h>
  3. #include <string.h>
  4. #define PROJECT_NAME "myproject"
  5. char *x(char *name) {
  6. char a[100]="Hello ";
  7. return strcat(a, name);
  8. }
  9. int main(int argc, char **argv) {
  10. printf("%s\n", x("fer"));
  11. return 0;
  12. }

I compile it but it's working bad :(, then I run :

command output

|| gcc -o a1 myproject.c || $ ./a1.exe This is project myproject. ■d

||

please give me suggestion because i try it on linux, I thins the code is ok.

Ticket History (2/2 Histories)

2020-06-24 05:26 Updated by: xero
  • New Ticket "gcc on msys2 the compiler is failing" created
2020-06-24 07:14 Updated by: keith
  • Resolución Update from Ninguno to Invalid
  • Estado Update from Open to Cerrado
Comentario

<sigh>How many times must I reject such invalid tickets?</sigh>

MSYS2 is not a MinGW.org product ... indeed, their use of "mingw" within their product name infringes our registered trademark. We do not offer support for any product from such rogue projects, but in any case, it is your code which is broken ... it is a classical example of "undefined behaviour".

(Edited, 2020-06-24 07:17 Updated by: keith)

Attachment File List

No attachments

Editar

Please login to add comment to this ticket » Entrar