{"action":"created","issue":{"url":"https://api.github.com/repos/gap-system/gap/issues/2033","repository_url":"https://api.github.com/repos/gap-system/gap","labels_url":"https://api.github.com/repos/gap-system/gap/issues/2033/labels{/name}","comments_url":"https://api.github.com/repos/gap-system/gap/issues/2033/comments","events_url":"https://api.github.com/repos/gap-system/gap/issues/2033/events","html_url":"https://github.com/gap-system/gap/issues/2033","id":283179581,"number":2033,"title":"seg fault with `Position` ","user":{"login":"pedritomelenas","id":9551023,"avatar_url":"https://avatars0.githubusercontent.com/u/9551023?v=4","gravatar_id":"","url":"https://api.github.com/users/pedritomelenas","html_url":"https://github.com/pedritomelenas","followers_url":"https://api.github.com/users/pedritomelenas/followers","following_url":"https://api.github.com/users/pedritomelenas/following{/other_user}","gists_url":"https://api.github.com/users/pedritomelenas/gists{/gist_id}","starred_url":"https://api.github.com/users/pedritomelenas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedritomelenas/subscriptions","organizations_url":"https://api.github.com/users/pedritomelenas/orgs","repos_url":"https://api.github.com/users/pedritomelenas/repos","events_url":"https://api.github.com/users/pedritomelenas/events{/privacy}","received_events_url":"https://api.github.com/users/pedritomelenas/received_events","type":"User","site_admin":false},"labels":[{"id":180442294,"url":"https://api.github.com/repos/gap-system/gap/labels/bug","name":"bug","color":"e11d21","default":true},{"id":300484896,"url":"https://api.github.com/repos/gap-system/gap/labels/crash","name":"crash","color":"e11d21","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-12-19T10:39:00Z","updated_at":"2017-12-19T12:08:10Z","closed_at":null,"author_association":"NONE","body":"As commented on slack (random channel) I got this segfault\r\n\r\n```\r\n➜  ToDo gapm\r\n ┌───────┐   GAP 4.8.8-4372-g5594dbb of today\r\n │  GAP  │   https://www.gap-system.org\r\n └───────┘   Architecture: x86_64-apple-darwin16.7.0-gcc-default64\r\n Configuration:  gmp 6.0.0\r\n Loading the library and packages ...\r\n Packages:   GAPDoc 1.6, IO 4.4.6, PrimGrp 3.1.2, smallgrp 1.2, transgrp 2.0\r\n             \r\n Try '??help' for help. See also '?copyright', '?cite' and '?authors'\r\ngap> LoadPackage(\"num\");\r\n#I  Please load package NormalizInterface or 4ti2Interface\r\n#I  to have extended functionalities.\r\n#I  Please load package SingularInterface or singular (not both)\r\n#I  or GradedModules to have extended functionalities.\r\n----------------------------------------------------------------\r\nLoading  NumericalSgps 1.1.5\r\nFor help, type: ?NumericalSgps: \r\n----------------------------------------------------------------\r\ntrue\r\ngap> Read(\"number-element.gd\");\r\ngap> Read(\"number-element.gi\");\r\nError, required filters [ \"IsComponentObjectRep\", \"IsAttributeStoringRep\", \"IsListOrCollection\", \r\n  \"IsCollection\", \"IsDuplicateFree\", \"HasIsDuplicateFree\", \"IsExtAElement\", \r\n  \"CategoryCollections(IsExtAElement)\", \r\n  \"CategoryCollections(IsNearAdditiveElement)\", \r\n  \"CategoryCollections(IsAdditiveElement)\", \"IsGeneralizedDomain\", \r\n  \"IsNearAdditiveMagma\", \"IsAdditivelyCommutative\", \r\n  \"HasIsAdditivelyCommutative\", \"IsNumericalSemigroupRep\", \r\n  \"IsNumericalSemigroup\" ]\r\nfor 1st argument do not match a declaration of PositionError, List Element: <list>[13576] must have an assigned value in\r\n  [1]    1577 segmentation fault  gapm\r\n```\r\n\r\nThe files are \r\nnumber-element.gd:\r\n```\r\n#############################################################################\r\n##\r\n#F ElementNumber_NumericalSemigroup(S,n)\r\n# Given a numerical semigroup S and an integer n, returns the nth element of S\r\n#############################################################################\r\nDeclareGlobalFunction(\"ElementNumber_NumericalSemigroup\");\r\n#############################################################################\r\n##\r\n#F NumberElement_NumericalSemigroup(S,n)\r\n# Given a numerical semigroup S and an integer n, returns the position of \r\n# n in S\r\n#############################################################################\r\nDeclareGlobalFunction(\"NumberElement_NumericalSemigroup\");\r\n```\r\nand \r\nnumber-element.gi:\r\n```\r\n#############################################################################\r\n##\r\n#F ElementNumber_NumericalSemigroup(S,n)\r\n# Given a numerical semigroup S and an integer n, returns the nth element of S\r\n#############################################################################\r\nInstallGlobalFunction(ElementNumber_NumericalSemigroup, \r\n    function(s,n)\r\n        return RthElementOfNumericalSemigroup(s,n);\r\n    end\r\n);\r\n#############################################################################\r\n##\r\n#F NumberElement_NumericalSemigroup(S,n)\r\n# Given a numerical semigroup S and an integer n, returns the position of \r\n# n in S\r\n#############################################################################\r\nInstallGlobalFunction(NumberElement_NumericalSemigroup,\r\n    function(s,n)\r\n        local f, nse;\r\n        if not(n in s) then \r\n            return(fail);\r\n        fi;\r\n        f:=FrobeniusNumber(s);\r\n        if n<f then \r\n            return Position(SmallElements(s),n);\r\n        fi;\r\n        nse:=Length(SmallElements(s));\r\n        return nse+n-f-1;\r\n    end\r\n);\r\nInstallMethod(Position, [IsNumericalSemigroup,IsInt],\r\n    NumberElement_NumericalSemigroup\r\n);\r\n```\r\n\r\nI have abandoned the idea of adding `Position` as suggested by @fingolfin , but the seg fault could be studied. @markuspf  and @fingolfin already noticed that in the -master branch the segmentation fault does not occur, neither on stable-4.9.\r\n\r\nThanks,\r\nPedro"},"comment":{"url":"https://api.github.com/repos/gap-system/gap/issues/comments/352731262","html_url":"https://github.com/gap-system/gap/issues/2033#issuecomment-352731262","issue_url":"https://api.github.com/repos/gap-system/gap/issues/2033","id":352731262,"user":{"login":"pedritomelenas","id":9551023,"avatar_url":"https://avatars0.githubusercontent.com/u/9551023?v=4","gravatar_id":"","url":"https://api.github.com/users/pedritomelenas","html_url":"https://github.com/pedritomelenas","followers_url":"https://api.github.com/users/pedritomelenas/followers","following_url":"https://api.github.com/users/pedritomelenas/following{/other_user}","gists_url":"https://api.github.com/users/pedritomelenas/gists{/gist_id}","starred_url":"https://api.github.com/users/pedritomelenas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedritomelenas/subscriptions","organizations_url":"https://api.github.com/users/pedritomelenas/orgs","repos_url":"https://api.github.com/users/pedritomelenas/repos","events_url":"https://api.github.com/users/pedritomelenas/events{/privacy}","received_events_url":"https://api.github.com/users/pedritomelenas/received_events","type":"User","site_admin":false},"created_at":"2017-12-19T12:08:10Z","updated_at":"2017-12-19T12:08:10Z","author_association":"NONE","body":"Yes, only on 4.8.8."}}
{"actor":{"display_login":"pedritomelenas"}}