{"action":"created","issue":{"url":"https://api.github.com/repos/tgingold/ghdl/issues/152","repository_url":"https://api.github.com/repos/tgingold/ghdl","labels_url":"https://api.github.com/repos/tgingold/ghdl/issues/152/labels{/name}","comments_url":"https://api.github.com/repos/tgingold/ghdl/issues/152/comments","events_url":"https://api.github.com/repos/tgingold/ghdl/issues/152/events","html_url":"https://github.com/tgingold/ghdl/issues/152","id":178584265,"number":152,"title":"ghdl 0.33 crashes on VHPI","user":{"login":"stdefeber","id":10972516,"avatar_url":"https://avatars.githubusercontent.com/u/10972516?v=3","gravatar_id":"","url":"https://api.github.com/users/stdefeber","html_url":"https://github.com/stdefeber","followers_url":"https://api.github.com/users/stdefeber/followers","following_url":"https://api.github.com/users/stdefeber/following{/other_user}","gists_url":"https://api.github.com/users/stdefeber/gists{/gist_id}","starred_url":"https://api.github.com/users/stdefeber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stdefeber/subscriptions","organizations_url":"https://api.github.com/users/stdefeber/orgs","repos_url":"https://api.github.com/users/stdefeber/repos","events_url":"https://api.github.com/users/stdefeber/events{/privacy}","received_events_url":"https://api.github.com/users/stdefeber/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-22T11:26:33Z","updated_at":"2016-09-23T10:54:13Z","closed_at":"2016-09-23T01:19:57Z","body":"I want to create a link between my simulation via a message queue and some yet to be defined application. See code below.\r\n\r\n$> ghdl --version \r\n\r\nGHDL 0.33 (20150921) [Dunoon edition]\r\nCompiled with GNAT Version: 5.3.0\r\n\r\nHowever ghdl crashes with : \r\n```\r\nax_wb_pli.vhdl:8:0: internal compiler error: Segmentation fault\r\n entity ax_wb_pli is\r\n ^\r\n0x96e70f crash_signal\r\n        ../../gcc-4.9.3/gcc/toplev.c:337\r\n0x966dd1 place_field(record_layout_info_s*, tree_node*)\r\n        ../../gcc-4.9.3/gcc/stor-layout.c:1098\r\n0x96806a layout_type(tree_node*)\r\n        ../../gcc-4.9.3/gcc/stor-layout.c:2287\r\n0x59b9b1 finish_record_type\r\n        ../../gcc-4.9.3/gcc/vhdl/ortho-lang.c:1140\r\n0x6306c6 trans__chap10__pop_instance_factory\r\n        /opt/ghdl_build/gcc-4.9.3/gcc/vhdl/trans.adb:293\r\n0x6488b7 trans__chap8__translate_procedure_call_state\r\n        /opt/ghdl_build/gcc-4.9.3/gcc/vhdl/trans-chap8.adb:2370\r\n0x65505f trans__chap4__translate_statements_chain_state_declaration\r\n        /opt/ghdl_build/gcc-4.9.3/gcc/vhdl/trans-chap4.adb:2162\r\n0x63dcd0 trans__chap9__translate_process_declarations\r\n        /opt/ghdl_build/gcc-4.9.3/gcc/vhdl/trans-chap9.adb:253\r\n0x63dcd0 trans__chap9__translate_block_declarations\r\n        /opt/ghdl_build/gcc-4.9.3/gcc/vhdl/trans-chap9.adb:817\r\n0x666b98 trans__chap1__translate_architecture_body\r\n        /opt/ghdl_build/gcc-4.9.3/gcc/vhdl/trans-chap1.adb:221\r\n0x6371bb translation__translate\r\n        /opt/ghdl_build/gcc-4.9.3/gcc/vhdl/translation.adb:298\r\n0x6688d6 ortho_front__parse\r\n        /opt/ghdl_build/gcc-4.9.3/gcc/vhdl/ortho_front.adb:407\r\n0x5ba58e lang_parse_file\r\n        /opt/ghdl_build/gcc-4.9.3/gcc/vhdl/ortho_gcc.adb:114\r\n0x5979bf ortho_parse_file\r\n        ../../gcc-4.9.3/gcc/vhdl/ortho-lang.c:496\r\nPlease submit a full bug report,\r\nwith preprocessed source if appropriate.\r\nPlease include the complete backtrace with any bug report.\r\nSee <http://gcc.gnu.org/bugs.html> for instructions.\r\nghdl: exec error\r\n```\r\nCode ax_wb_pli_pkg.vhdl :\r\n---------------------------------------------------------------------------\r\n```\r\nlibrary ieee;\r\nuse     ieee.std_logic_1164.all;\r\nuse     ieee.numeric_std.all;\r\n\r\npackage ax_wb_pli_pkg is\r\n\r\n  type bus_t is access integer;\r\n\r\n  function init_queue(queue_id : integer) return integer;\r\n    attribute foreign of init_queue : function is \"VHPIDIRECT sim_init_queue\";\r\n\r\n  procedure delete_queue(queue_id : integer);\r\n    attribute foreign of delete_queue : procedure is \"VHPIDIRECT sim_delete_queue\";\r\n\r\nend package;\r\n\r\npackage body ax_wb_pli_pkg is\r\n\r\n  function init_queue(queue_id : integer) return integer is\r\n  begin\r\n    assert false report \"VHPI\" severity failure;\r\n  end function;\r\n\r\n  procedure delete_queue(queue_id : integer) is\r\n  begin\r\n    assert false report \"VHPI\" severity failure;\r\n  end procedure;\r\n\r\nend package body;\r\n```\r\n---------------------------------------------------------------------------\r\nEnd of Code ax_wb_pli_pkg.vhdl\r\n\r\n---------------------------------------------------------------------------\r\n\r\nCode of ax_wb_pli.vhdl\r\n---------------------------------------------------------------------------\r\n```\r\nlibrary ieee;\r\nuse     ieee.std_logic_1164.all;\r\nuse     ieee.numeric_std.all;\r\n\r\nlibrary work;\r\nuse     work.ax_wb_pli_pkg.all;\r\n\r\nentity ax_wb_pli is\r\nend entity ax_wb_pli;\r\n\r\narchitecture behav of ax_wb_pli is\r\n\r\n  constant cQUEUE_ID : integer := 0;\r\n  shared variable queue_handle : integer;\r\n\r\nbegin\r\n\r\n  \r\n  init_bus_handle : process \r\n  begin\r\n    queue_handle := init_queue(cQUEUE_ID);\r\n    if (bus_handle = 0) then\r\n      assert false report \"Failed to register Message Queue\";\r\n    end if;  \r\n    wait for 1 us;\r\n    queue_delete(cQUEUE_ID);\r\n  end process;\r\n\r\n\r\nend behav;\r\n```\r\n---------------------------------------------------------------------------\r\nEnd of Code of ax_wb_pli.vhdl\r\n---------------------------------------------------------------------------\r\nCode of ax_wb_pli.c\r\n---------------------------------------------------------------------------\r\n```\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <ctype.h>\r\n#include <sys/types.h>\r\n#include <sys/ipc.h>\r\n#include <sys/msg.h>\r\n\r\nint sim_init_queue (int qid)\r\n{\r\n  key_t  key;\r\n  int    msgqueue_id;\r\n  //struct mymsgbuf qbuf;\r\n\r\n  /* Create unique key via call to ftok() */\r\n  key = ftok(\".\", 'm');\r\n\r\n  /* Open the queue - create if necessary */\r\n  if((msgqueue_id = msgget(key, IPC_CREAT|0660)) == -1) {\r\n          perror(\"msgget\");\r\n          exit(1);\r\n  }\r\n  return msgqueue_id;\r\n\r\n}\r\n\r\nint sim_delete_queue(int qid)\r\n{\r\n\r\n  /* Remove the queue */\r\n  msgctl(qid, IPC_RMID, 0);\r\n\r\n  return 0;\r\n\r\n}\r\n\r\n\r\nint main ()\r\n{\r\n\r\n  return 0;          \r\n\r\n}\r\n```\r\n---------------------------------------------------------------------------\r\nEnd of Code of ax_wb_pli.c\r\n---------------------------------------------------------------------------\r\n\r\nBuild script :\r\n\r\ngcc -Wall -fPIC ax_wb_pli.c -o ax_wb_pli.o\r\nghdl -i --work=work ax_wb_pli.vhdl ax_wb_pli_pkg.vhdl\r\nghdl -m -Wl,ax_wb_pli.o --work=work ax_wb_pli\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/tgingold/ghdl/issues/comments/249161496","html_url":"https://github.com/tgingold/ghdl/issues/152#issuecomment-249161496","issue_url":"https://api.github.com/repos/tgingold/ghdl/issues/152","id":249161496,"user":{"login":"diogratia","id":1286860,"avatar_url":"https://avatars.githubusercontent.com/u/1286860?v=3","gravatar_id":"","url":"https://api.github.com/users/diogratia","html_url":"https://github.com/diogratia","followers_url":"https://api.github.com/users/diogratia/followers","following_url":"https://api.github.com/users/diogratia/following{/other_user}","gists_url":"https://api.github.com/users/diogratia/gists{/gist_id}","starred_url":"https://api.github.com/users/diogratia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diogratia/subscriptions","organizations_url":"https://api.github.com/users/diogratia/orgs","repos_url":"https://api.github.com/users/diogratia/repos","events_url":"https://api.github.com/users/diogratia/events{/privacy}","received_events_url":"https://api.github.com/users/diogratia/received_events","type":"User","site_admin":false},"created_at":"2016-09-23T10:54:13Z","updated_at":"2016-09-23T10:54:13Z","body":"And using Tristan's modifications the design analyzes and elaborates on OS X with llvm. There is no timeout mechanism in process init_bus_handle. When run it appears it will go on until simulation time hits time'HIGH.\r\n\r\nAdding a timeout to the process and the simulation completes.\r\n\r\n```\r\ndavid_koontz@Macbook: ax_wb_pli\r\nax_wb_pli.vhdl:29:9:@11us:(report note): timeout\r\n\r\nGHDL 0.34dev (20151126) [Dunoon edition]\r\n Compiled with GNAT Version: GPL 2015 (20150428-49)\r\n\r\nCommit:\r\n2566852c5601fd03f4a9c6b5939d30a56d919c5d [2566852]\r\nParents:\r\nd6cb5a78af\r\nAuthor:\r\nTristan Gingold <tgingold@free.fr>\r\nDate:\r\n30 August 2016 3:00:02 pm NZST\r\nCommit Date:\r\n30 August 2016 3:12:39 pm NZST\r\n\r\n```"}}
{"actor":{"display_login":"diogratia"}}