{"action":"created","issue":{"url":"https://api.github.com/repos/bebbo/gcc/issues/38","repository_url":"https://api.github.com/repos/bebbo/gcc","labels_url":"https://api.github.com/repos/bebbo/gcc/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/bebbo/gcc/issues/38/comments","events_url":"https://api.github.com/repos/bebbo/gcc/issues/38/events","html_url":"https://github.com/bebbo/gcc/issues/38","id":373326296,"node_id":"MDU6SXNzdWUzNzMzMjYyOTY=","number":38,"title":"[-fbaserel]  error: unable to find a register to spill in class 'A0_REGS'","user":{"login":"mheyer32","id":33539855,"node_id":"MDQ6VXNlcjMzNTM5ODU1","avatar_url":"https://avatars3.githubusercontent.com/u/33539855?v=4","gravatar_id":"","url":"https://api.github.com/users/mheyer32","html_url":"https://github.com/mheyer32","followers_url":"https://api.github.com/users/mheyer32/followers","following_url":"https://api.github.com/users/mheyer32/following{/other_user}","gists_url":"https://api.github.com/users/mheyer32/gists{/gist_id}","starred_url":"https://api.github.com/users/mheyer32/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mheyer32/subscriptions","organizations_url":"https://api.github.com/users/mheyer32/orgs","repos_url":"https://api.github.com/users/mheyer32/repos","events_url":"https://api.github.com/users/mheyer32/events{/privacy}","received_events_url":"https://api.github.com/users/mheyer32/received_events","type":"User","site_admin":false},"labels":[{"id":1145413118,"node_id":"MDU6TGFiZWwxMTQ1NDEzMTE4","url":"https://api.github.com/repos/bebbo/gcc/labels/close%20pending","name":"close pending","color":"ed9c9f","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":29,"created_at":"2018-10-24T06:36:04Z","updated_at":"2018-12-29T15:10:11Z","closed_at":"2018-12-29T00:23:35Z","author_association":"NONE","body":"Encountered while trying to compile a file with -fbaserel.\r\nIt compiles without.\r\n\r\nThis is not super urgent - I don't even know if we can compile this library this way in general,\r\nbut I thought internal compiler errors of this sort are not to be expected in any case.\r\n\r\n```\r\n>>>>>Compiling ftp_addressbook.c\r\nUsing built-in specs.\r\nCOLLECT_GCC=m68k-amigaos-gcc\r\nTarget: m68k-amigaos\r\nConfigured with: /home/matze/amigatoolchain/amiga-gcc/projects/gcc/configure --prefix=/home/matze/amigatoolchain/amiga-gcc-out --target=m68k-amigaos --enable-languages=c,c++,objc --enable-version-specific-runtime-libs --disable-libssp --disable-nls --with-headers=/home/matze/amigatoolchain/amiga-gcc/projects/newlib-cygwin/newlib/libc/sys/amigaos/include/ --disable-shared --with-stage1-ldflags='-dynamic-libgcc -dynamic-libstdc++' --with-boot-ldflags='-dynamic-libgcc -dynamic-libstdc++'\r\nThread model: single\r\ngcc version 6.4.1b 20181021-224453 (GCC) \r\nCOLLECT_GCC_OPTIONS='-c' '-mcpu=68020' '-fbaserel' '-D' '__amigaos3__' '-D' 'COMPDATE=23.10.2018' '-D' '__NO_NET_API' '-D' 'DEBUG' '-O2' '-noixemul' '-v' '-I' '../../Include' '-I' './' '-I' '../../' '-I' '/usr/local/amiga/m68k-amigaos/netinclude' '-Wall' '-o' 'ftp_addressbook.o' '-B' '/home/matze/amigatoolchain/amiga-gcc-out/m68k-amigaos/libnix/lib/'\r\n /home/matze/amigatoolchain/amiga-gcc-out/libexec/gcc/m68k-amigaos/6.4.1b/cc1 -quiet -v -I ../../Include -I ./ -I ../../ -I /usr/local/amiga/m68k-amigaos/netinclude -imultilib libm020/libb -iprefix /home/matze/amigatoolchain/amiga-gcc-out/lib/gcc/m68k-amigaos/6.4.1b/ -isystem /home/matze/amigatoolchain/amiga-gcc-out/include -isystem /home/matze/amigatoolchain/amiga-gcc-out/m68k-amigaos/libnix/include -Dlibnix -D__libnix__ -D__libnix -D __amigaos3__ -D COMPDATE=23.10.2018 -D __NO_NET_API -D DEBUG ftp_addressbook.c -quiet -dumpbase ftp_addressbook.c -mcpu=68020 -auxbase-strip ftp_addressbook.o -O2 -Wall -version -fbaserel -o /tmp/ccdFjvlx.s\r\nGNU C11 (GCC) version 6.4.1b 20181021-224453 (m68k-amigaos)\r\n\r\n```\tcompiled by GNU C version 4.9.2, GMP version 6.0.0, MPFR version 3.1.2-p11, MPC version 1.0.3, isl version none\r\nGGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072\r\nignoring nonexistent directory \"/home/matze/amigatoolchain/amiga-gcc-out/libexec/gcc/m68k-amigaos/lib/gcc/m68k-amigaos/6.4.1b/include\"\r\nignoring nonexistent directory \"/home/matze/amigatoolchain/amiga-gcc-out/libexec/gcc/m68k-amigaos/m68k-amigaos/ndk-include\"\r\nignoring nonexistent directory \"/home/matze/amigatoolchain/amiga-gcc-out/libexec/gcc/m68k-amigaos/m68k-amigaos/sys-include\"\r\nignoring nonexistent directory \"/home/matze/amigatoolchain/amiga-gcc-out/libexec/gcc/m68k-amigaos/m68k-amigaos/include\"\r\nignoring nonexistent directory \"/usr/local/amiga/m68k-amigaos/netinclude\"\r\n#include \"...\" search starts here:\r\n#include <...> search starts here:\r\n ../../Include\r\n ./\r\n ../../\r\n /home/matze/amigatoolchain/amiga-gcc-out/include\r\n /home/matze/amigatoolchain/amiga-gcc-out/m68k-amigaos/libnix/include\r\n /home/matze/amigatoolchain/amiga-gcc-out/lib/gcc/m68k-amigaos/6.4.1b/include\r\n /home/matze/amigatoolchain/amiga-gcc-out/m68k-amigaos/ndk-include\r\n /home/matze/amigatoolchain/amiga-gcc-out/m68k-amigaos/sys-include\r\n /home/matze/amigatoolchain/amiga-gcc-out/m68k-amigaos/include\r\nEnd of search list.\r\nGNU C11 (GCC) version 6.4.1b 20181021-224453 (m68k-amigaos)\r\n\tcompiled by GNU C version 4.9.2, GMP version 6.0.0, MPFR version 3.1.2-p11, MPC version 1.0.3, isl version none\r\nGGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072\r\nCompiler executable checksum: 30fe58c468361392395558fa369ff8a9\r\n```\r\n\r\n\r\n```\r\nftp_addressbook.c:4239:1: error: unable to find a register to spill in class 'A0_REGS'\r\n }\r\n ^\r\nftp_addressbook.c:4239:1: error: this is the insn:\r\n(insn 1370 1369 1371 175 (set (reg/v:SI 3 d3 [ _n8 ])\r\n        (sign_extend:SI (mem:HI (plus:SI (reg/f:SI 4 d4 [orig:576 _GetDragInfo_re2.222_1059 ] [576])\r\n                    (const_int 10 [0xa])) [14 _GetDragInfo_re2.222_1059->height+0 S2 A16]))) ftp_addressbook.c:269 79 {*68k_extendhisi2}\r\n     (nil))\r\nftp_addressbook.c:4239: confused by earlier errors, bailing out\r\nmakefile.os3:42: recipe for target 'ftp_addressbook.o' failed\r\nmake: *** [ftp_addressbook.o] Error 1\r\n```\r\n\r\n[ftp_addressbook.txt](https://github.com/bebbo/gcc/files/2509208/ftp_addressbook.txt)"},"comment":{"url":"https://api.github.com/repos/bebbo/gcc/issues/comments/450499159","html_url":"https://github.com/bebbo/gcc/issues/38#issuecomment-450499159","issue_url":"https://api.github.com/repos/bebbo/gcc/issues/38","id":450499159,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MDQ5OTE1OQ==","user":{"login":"bebbo","id":16560863,"node_id":"MDQ6VXNlcjE2NTYwODYz","avatar_url":"https://avatars0.githubusercontent.com/u/16560863?v=4","gravatar_id":"","url":"https://api.github.com/users/bebbo","html_url":"https://github.com/bebbo","followers_url":"https://api.github.com/users/bebbo/followers","following_url":"https://api.github.com/users/bebbo/following{/other_user}","gists_url":"https://api.github.com/users/bebbo/gists{/gist_id}","starred_url":"https://api.github.com/users/bebbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bebbo/subscriptions","organizations_url":"https://api.github.com/users/bebbo/orgs","repos_url":"https://api.github.com/users/bebbo/repos","events_url":"https://api.github.com/users/bebbo/events{/privacy}","received_events_url":"https://api.github.com/users/bebbo/received_events","type":"User","site_admin":false},"created_at":"2018-12-29T15:10:11Z","updated_at":"2018-12-29T15:10:11Z","author_association":"OWNER","body":"> I needed to provide my own __restore_a4() implementation:\r\n\r\nif you look into crt0.c then you'll find\r\n```\r\nvoid __entrypoint __restore_a4(void) {\r\n\tasm(\"lea ___a4_init,a4\");\r\n}\r\n```\r\n`__entrypoint` means that no registers are saved - no push, no pop.\r\n\r\n> There are two issues with using a4/a5 for Library calls\r\nwriting libraries using many (almost all) registers seems futile, if it's your librarary, provide a structure or a taglist (-> that's why taglists exist).\r\n> 1. at the call site:\r\nyou can write a macro which swaps d7/a4 and d6/a5 (or different data data registers) for a call.\r\n> 2. at the callee site:\r\nwriting a function using the baserel pointer in a4 plus a register parameter in a4...\r\n... who would do that?\r\nsame for a function using a5 as stack frame pointer plus a register parameter in a5.\r\n\r\nYour approach for Dopus sounds well but I simply wouldn't apply baserel to that library :-)\r\n\r\nAnd pointers in data registers aren't a problem:\r\n```\r\nint foo(register int * x asm(\"d0\")) {\r\n  return *x;\r\n}\r\n```\r\nyields\r\n```\r\n_foo:\r\n        move.l d0,a0\r\n        move.l (a0),d0\r\n        rts\r\n```"}}
{"actor":{"display_login":"bebbo"}}