{"action":"created","issue":{"url":"https://api.github.com/repos/ldc-developers/ldc/issues/2777","repository_url":"https://api.github.com/repos/ldc-developers/ldc","labels_url":"https://api.github.com/repos/ldc-developers/ldc/issues/2777/labels{/name}","comments_url":"https://api.github.com/repos/ldc-developers/ldc/issues/2777/comments","events_url":"https://api.github.com/repos/ldc-developers/ldc/issues/2777/events","html_url":"https://github.com/ldc-developers/ldc/issues/2777","id":341375640,"node_id":"MDU6SXNzdWUzNDEzNzU2NDA=","number":2777,"title":"Compiler crash using `main` in a package.d file","user":{"login":"JinShil","id":6023641,"node_id":"MDQ6VXNlcjYwMjM2NDE=","avatar_url":"https://avatars1.githubusercontent.com/u/6023641?v=4","gravatar_id":"","url":"https://api.github.com/users/JinShil","html_url":"https://github.com/JinShil","followers_url":"https://api.github.com/users/JinShil/followers","following_url":"https://api.github.com/users/JinShil/following{/other_user}","gists_url":"https://api.github.com/users/JinShil/gists{/gist_id}","starred_url":"https://api.github.com/users/JinShil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JinShil/subscriptions","organizations_url":"https://api.github.com/users/JinShil/orgs","repos_url":"https://api.github.com/users/JinShil/repos","events_url":"https://api.github.com/users/JinShil/events{/privacy}","received_events_url":"https://api.github.com/users/JinShil/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":17,"created_at":"2018-07-16T02:36:51Z","updated_at":"2018-07-18T10:37:10Z","closed_at":null,"author_association":"NONE","body":"board/package.d\r\n```D\r\nmodule board;\r\n\r\nextern void main();\r\nextern(C) void reset()\r\n{\r\n    main();\r\n}\r\n```\r\n\r\nruntime/object.d\r\n```D\r\nmodule object;\r\n```\r\n\r\nCompile\r\n```\r\n$ ldc2 -c -defaultlib= -conf= -Iruntime board/package.d\r\nLLVMSymbolizer: error reading file: No such file or directory\r\n#0 0x000000000289061a (ldc2+0x289061a)\r\n#1 0x000000000288e8de (ldc2+0x288e8de)\r\n#2 0x000000000288ea02 (ldc2+0x288ea02)\r\n#3 0x00007f1e3b2c7a80 __restore_rt (/usr/lib/libpthread.so.0+0x11a80)\r\n#4 0x0000000000c8729a (ldc2+0xc8729a)\r\n#5 0x0000000000c90c3b (ldc2+0xc90c3b)\r\n#6 0x0000000000c90eff (ldc2+0xc90eff)\r\n#7 0x0000000000c8da7d (ldc2+0xc8da7d)\r\n#8 0x0000000000c798d0 (ldc2+0xc798d0)\r\n#9 0x0000000000c7b044 (ldc2+0xc7b044)\r\n#10 0x0000000000c794d4 (ldc2+0xc794d4)\r\n#11 0x0000000000c3eaab (ldc2+0xc3eaab)\r\n#12 0x0000000000c33523 (ldc2+0xc33523)\r\n#13 0x0000000000c36634 (ldc2+0xc36634)\r\n#14 0x0000000000c55ec5 (ldc2+0xc55ec5)\r\n#15 0x0000000000d01449 (ldc2+0xd01449)\r\n#16 0x0000000000cd7226 (ldc2+0xcd7226)\r\n#17 0x0000000000afa990 (ldc2+0xafa990)\r\n#18 0x0000000000cd5007 (ldc2+0xcd5007)\r\n#19 0x00000000029d5420 (ldc2+0x29d5420)\r\n#20 0x00000000029d52a6 (ldc2+0x29d52a6)\r\n#21 0x00007f1e3a97006b __libc_start_main (/usr/lib/libc.so.6+0x2306b)\r\n#22 0x0000000000a22455 (ldc2+0xa22455)\r\nSegmentation fault (core dumped)\r\n```\r\n\r\nCommenting out the call to `main` avoids the crash.\r\n```D\r\nmodule board;\r\n\r\nextern void main();\r\nextern(C) void reset()\r\n{\r\n    // main();\r\n}\r\n```\r\n\r\nThe above is just a reduced test to reproduce the error.  In my actual application I receive an additional error message \"only one main function allowed\"\r\n```\r\n$ ldc2 -c -Os -mtriple=thumb-none-eabi -float-abi=hard -mcpu=cortex-m4 -Isource/runtime source/board/random.d source/board/spi5.d source/board/lcd.d source/board/ltdc.d source/board/statusLED.d source/board/ILI9341.d source/board/package.d source/main.d source/stm32f42/pwr.d source/stm32f42/scb.d source/stm32f42/mmio.d source/stm32f42/dma2d.d source/stm32f42/spi.d source/stm32f42/bus.d source/stm32f42/flash.d source/stm32f42/ltdc.d source/stm32f42/rcc.d source/stm32f42/rng.d source/stm32f42/trace.d source/stm32f42/nvic.d source/stm32f42/gpio.d -of=binary/firmware.o\r\nsource/board/package.d(36): Error: only one main function allowed\r\nLLVMSymbolizer: error reading file: No such file or directory\r\n#0 0x000000000289061a (ldc2+0x289061a)\r\n#1 0x000000000288e8de (ldc2+0x288e8de)\r\n#2 0x000000000288ea02 (ldc2+0x288ea02)\r\n#3 0x00007f7a125f8a80 __restore_rt (/usr/lib/libpthread.so.0+0x11a80)\r\n#4 0x0000000000c8729a (ldc2+0xc8729a)\r\n#5 0x0000000000c90c3b (ldc2+0xc90c3b)\r\n#6 0x0000000000c90eff (ldc2+0xc90eff)\r\n#7 0x0000000000c8da7d (ldc2+0xc8da7d)\r\n#8 0x0000000000c798d0 (ldc2+0xc798d0)\r\n#9 0x0000000000c7b044 (ldc2+0xc7b044)\r\n#10 0x0000000000c7b044 (ldc2+0xc7b044)\r\n#11 0x0000000000c794d4 (ldc2+0xc794d4)\r\n#12 0x0000000000c3eaab (ldc2+0xc3eaab)\r\n#13 0x0000000000c33523 (ldc2+0xc33523)\r\n#14 0x0000000000c36634 (ldc2+0xc36634)\r\n#15 0x0000000000c55ec5 (ldc2+0xc55ec5)\r\n#16 0x0000000000d01449 (ldc2+0xd01449)\r\n#17 0x0000000000cd7226 (ldc2+0xcd7226)\r\n#18 0x0000000000afa990 (ldc2+0xafa990)\r\n#19 0x0000000000cd5007 (ldc2+0xcd5007)\r\n#20 0x00000000029d5420 (ldc2+0x29d5420)\r\n#21 0x00000000029d52a6 (ldc2+0x29d52a6)\r\n#22 0x00007f7a11ca106b __libc_start_main (/usr/lib/libc.so.6+0x2306b)\r\n#23 0x0000000000a22455 (ldc2+0xa22455)\r\nSegmentation fault (core dumped)\r\n```\r\n\r\nBut I haven't found a way to reproduce that error in a reduced test yet.\r\n\r\n\r\nCompiler Information:\r\n```\r\n$ ldc2 --version\r\nLDC - the LLVM D compiler (1.11.0-beta2):\r\n  based on DMD v2.081.1 and LLVM 6.0.1\r\n  built with LDC - the LLVM D compiler (1.11.0-beta2)\r\n  Default target: x86_64-unknown-linux-gnu\r\n  Host CPU: skylake\r\n  http://dlang.org - http://wiki.dlang.org/LDC\r\n\r\n  Registered Targets:\r\n    aarch64    - AArch64 (little endian)\r\n    aarch64_be - AArch64 (big endian)\r\n    arm        - ARM\r\n    arm64      - ARM64 (little endian)\r\n    armeb      - ARM (big endian)\r\n    mips       - Mips\r\n    mips64     - Mips64 [experimental]\r\n    mips64el   - Mips64el [experimental]\r\n    mipsel     - Mipsel\r\n    msp430     - MSP430 [experimental]\r\n    nvptx      - NVIDIA PTX 32-bit\r\n    nvptx64    - NVIDIA PTX 64-bit\r\n    ppc32      - PowerPC 32\r\n    ppc64      - PowerPC 64\r\n    ppc64le    - PowerPC 64 LE\r\n    riscv32    - 32-bit RISC-V\r\n    riscv64    - 64-bit RISC-V\r\n    thumb      - Thumb\r\n    thumbeb    - Thumb (big endian)\r\n    wasm32     - WebAssembly 32-bit\r\n    wasm64     - WebAssembly 64-bit\r\n    x86        - 32-bit X86: Pentium-Pro and above\r\n    x86-64     - 64-bit X86: EM64T and AMD64\r\n```"},"comment":{"url":"https://api.github.com/repos/ldc-developers/ldc/issues/comments/405887844","html_url":"https://github.com/ldc-developers/ldc/issues/2777#issuecomment-405887844","issue_url":"https://api.github.com/repos/ldc-developers/ldc/issues/2777","id":405887844,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTg4Nzg0NA==","user":{"login":"kinke","id":1889215,"node_id":"MDQ6VXNlcjE4ODkyMTU=","avatar_url":"https://avatars0.githubusercontent.com/u/1889215?v=4","gravatar_id":"","url":"https://api.github.com/users/kinke","html_url":"https://github.com/kinke","followers_url":"https://api.github.com/users/kinke/followers","following_url":"https://api.github.com/users/kinke/following{/other_user}","gists_url":"https://api.github.com/users/kinke/gists{/gist_id}","starred_url":"https://api.github.com/users/kinke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinke/subscriptions","organizations_url":"https://api.github.com/users/kinke/orgs","repos_url":"https://api.github.com/users/kinke/repos","events_url":"https://api.github.com/users/kinke/events{/privacy}","received_events_url":"https://api.github.com/users/kinke/received_events","type":"User","site_admin":false},"created_at":"2018-07-18T10:37:10Z","updated_at":"2018-07-18T10:37:10Z","author_association":"MEMBER","body":"> I think those should be nothrow, and could potentially also be @safe and @nogc. I think that would resolve the linker errors.\r\n\r\nThey are all 3, see the top of the file. You need the pragmas, that's how LDC recognizes them as intrinsics."}}
{"actor":{"display_login":"kinke"}}