{"action":"created","issue":{"url":"https://api.github.com/repos/ethereum/solidity/issues/5007","repository_url":"https://api.github.com/repos/ethereum/solidity","labels_url":"https://api.github.com/repos/ethereum/solidity/issues/5007/labels{/name}","comments_url":"https://api.github.com/repos/ethereum/solidity/issues/5007/comments","events_url":"https://api.github.com/repos/ethereum/solidity/issues/5007/events","html_url":"https://github.com/ethereum/solidity/issues/5007","id":361281563,"node_id":"MDU6SXNzdWUzNjEyODE1NjM=","number":5007,"title":"Compiling stdin with no content leads to internal error","user":{"login":"chriseth","id":9073706,"node_id":"MDQ6VXNlcjkwNzM3MDY=","avatar_url":"https://avatars2.githubusercontent.com/u/9073706?v=4","gravatar_id":"","url":"https://api.github.com/users/chriseth","html_url":"https://github.com/chriseth","followers_url":"https://api.github.com/users/chriseth/followers","following_url":"https://api.github.com/users/chriseth/following{/other_user}","gists_url":"https://api.github.com/users/chriseth/gists{/gist_id}","starred_url":"https://api.github.com/users/chriseth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chriseth/subscriptions","organizations_url":"https://api.github.com/users/chriseth/orgs","repos_url":"https://api.github.com/users/chriseth/repos","events_url":"https://api.github.com/users/chriseth/events{/privacy}","received_events_url":"https://api.github.com/users/chriseth/received_events","type":"User","site_admin":false},"labels":[{"id":249074435,"node_id":"MDU6TGFiZWwyNDkwNzQ0MzU=","url":"https://api.github.com/repos/ethereum/solidity/labels/bug%20:bug:","name":"bug :bug:","color":"fc1313","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-18T12:32:51Z","updated_at":"2018-10-15T14:35:35Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"```\r\n> solc --ast -\r\n<stdin>:2:1: Warning: Source file does not specify required compiler version!Consider adding \"pragma solidity ^0.4.26;\"\r\n\r\n^\r\nException during output generation: /home/chris/ethereum/solidity/libsolidity/interface/CompilerStack.cpp(761): Throw in function const string dev::solidity::CompilerStack::lastContractName() const\r\nDynamic exception type: boost::exception_detail::clone_impl<dev::solidity::CompilerError>\r\nstd::exception::what: No compiled contracts found.\r\n[dev::tag_comment*] = No compiled contracts found.\r\n```"},"comment":{"url":"https://api.github.com/repos/ethereum/solidity/issues/comments/429878062","html_url":"https://github.com/ethereum/solidity/issues/5007#issuecomment-429878062","issue_url":"https://api.github.com/repos/ethereum/solidity/issues/5007","id":429878062,"node_id":"MDEyOklzc3VlQ29tbWVudDQyOTg3ODA2Mg==","user":{"login":"mestorlx","id":15709678,"node_id":"MDQ6VXNlcjE1NzA5Njc4","avatar_url":"https://avatars0.githubusercontent.com/u/15709678?v=4","gravatar_id":"","url":"https://api.github.com/users/mestorlx","html_url":"https://github.com/mestorlx","followers_url":"https://api.github.com/users/mestorlx/followers","following_url":"https://api.github.com/users/mestorlx/following{/other_user}","gists_url":"https://api.github.com/users/mestorlx/gists{/gist_id}","starred_url":"https://api.github.com/users/mestorlx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mestorlx/subscriptions","organizations_url":"https://api.github.com/users/mestorlx/orgs","repos_url":"https://api.github.com/users/mestorlx/repos","events_url":"https://api.github.com/users/mestorlx/events{/privacy}","received_events_url":"https://api.github.com/users/mestorlx/received_events","type":"User","site_admin":false},"created_at":"2018-10-15T14:35:35Z","updated_at":"2018-10-15T14:35:35Z","author_association":"CONTRIBUTOR","body":"@chriseth the exemption is thrown from `string const CompilerStack::lastContractName() const`\r\nwhich is being called from `void CommandLineInterface::handleAst(string const& _argStr)` here is a code snippet \r\n``` cpp\r\n\t// do we need AST output?\r\n\tif (m_args.count(_argStr))\r\n\t{\r\n\t\tvector<ASTNode const*> asts;\r\n\t\tfor (auto const& sourceCode: m_sourceCodes)\r\n\t\t\tasts.push_back(&m_compiler->ast(sourceCode.first));\r\n\t\tmap<ASTNode const*, eth::GasMeter::GasConsumption> gasCosts;\r\n\t\t// FIXME: shouldn't this be done for every contract?\r\n\t\tif (m_compiler->runtimeAssemblyItems(m_compiler->lastContractName()))\r\n\t\t{\r\n\t\t\t//NOTE: keep the local variable `ret` to prevent a Heisenbug that could happen on certain mac os platform.\r\n\t\t\t//See: https://github.com/ethereum/solidity/issues/3718 for details.\r\n\t\t\tauto ret = GasEstimator::breakToStatementLevel(\r\n\t\t\t\tGasEstimator(m_evmVersion).structuralEstimation(*m_compiler->runtimeAssemblyItems(m_compiler->lastContractName()), asts),\r\n\t\t\t\tasts\r\n\t\t\t);\r\n\t\t\tgasCosts = ret;\r\n\t\t}\r\n```\r\n \r\nI see two options. First wrap the code inside try and catch. The second possibility would be to check if the `m_contracts` inside `CompilerStack` is empty  before hand. However, for this check we would need to add a method to `CompilerStack` to check if its empty or provide a getter for `m_contracts` since its a private member."}}
{"actor":{"display_login":"mestorlx"}}