任务单 #40502

gcc on msys2 the compiler is failing

开放日期: 2020-06-24 05:26 最后更新: 2020-06-24 07:14

报告人:
属主:
(无)
类型:
状态:
关闭
组件:
优先:
8
严重性:
5 - Medium
处理结果:
Invalid
文件:
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.

任务单历史 (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
  • 处理结果 Update from to Invalid
  • 状态 Update from 开启 to 关闭
评论

<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

编辑

Please login to add comment to this ticket » 登录名