From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-4.3 required=5.0 tests=ALL_TRUSTED,BAYES_00, RP_MATCHES_RCVD autolearn=unavailable autolearn_force=no version=3.4.1 To: devel@lists.altlinux.org References: <20201213003557.GA21193@imap.altlinux.org> <20201216132850.e2pjg72xocufuzhv@titan.localdomain> From: Alexey Sheplyakov Message-ID: <43ada68c-f56a-883a-b7d4-f207281a85ef@basealt.ru> Date: Fri, 18 Dec 2020 17:26:47 +0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201216132850.e2pjg72xocufuzhv@titan.localdomain> Content-Type: multipart/mixed; boundary="------------CBCF7153D6AA4C5F86BAC937" Content-Language: ru-RU Subject: Re: [devel] =?utf-8?b?0L/RgNC+0LHQu9C10LzQsCDRgSBib29zdDo6c3Bpcml0?= =?utf-8?b?INC90LAgaTU4NiDQuCBhcm1o?= X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Dec 2020 13:26:53 -0000 Archived-At: List-Archive: List-Post: This is a multi-part message in MIME format. --------------CBCF7153D6AA4C5F86BAC937 Content-Type: text/plain; charset=koi8-r; format=flowed Content-Transfer-Encoding: 8bit On 12/16/20 5:28 PM, Ivan A. Melnikov wrote: > On Sun, Dec 13, 2020 at 03:35:57AM +0300, Vladislav Zavjalov wrote: >> Обнаружил странную регрессию в одной из своих программ: >> на 32-битных архитектурах начались падения (Segmentation fault) >> где-то в районе boost::spirit (очень смешная библиотека для >> синтаксического разбора, когда-то давно она меня радовала). >> Судя по всему, произошло это одновременно с переходом на gcc-10, >> до этого пакет нормально пересобирался. >> >> Сделал тестовый пакет с каким-то минимальным кодом, пытался отлаживать >> на сборочнице, но точное место поймать пока не смог. Как только правила >> spirit становятся достаточно длинными - начинает падать. >> Зато выяснил, что падения лечатся убиранием флага -O2. >> Может быть, кому-нибудь такой рецепт поможет. >> >> Если кто-то захочет покопаться, то код есть тут: >> http://git.altlinux.org/tasks/263387/gears/2200/git >> А типичный лог на сборочнице выглядит так: >> http://git.altlinux.org/tasks/263387/build/2200/i586/log >> Собираю и запускаю программу дважды: без флага -O2 и с ним. >> Первый раз все работает, второй - падает. >> На armh - то же самое. > > > Я просто оставлю здесь то, что успел (пока) увидеть: > > [builder@localhost fig]$ g++ -O2 main.cpp fig_mask.cpp -o main && ./main > Segmentation fault (core dumped) > [builder@localhost fig]$ g++ -O2 -fno-tree-sra main.cpp fig_mask.cpp -o main && ./main > OK > [builder@localhost fig]$ g++-9 -O2 main.cpp fig_mask.cpp -o main && ./main > OK > Подтверждаю падение i386 бинарника, собранного g++-10 (неважно - кросс-компилятором, или "родным"). Достаточно даже не -O2, а просто -O. Программу удалось несколько ужать до #include #include using namespace boost::spirit::classic; int main() { const char str[] = " 1 2 3 4 5 6 7 8"; int f[8] = { 0, -1, -2, -3, -4, -5, -6, -7 }; rule<> myrule = +blank_p >> (ch_p('*') | int_p[assign_a(f[0])]) >> +blank_p >> (ch_p('*') | int_p[assign_a(f[1])]) >> +blank_p >> (ch_p('*') | int_p[assign_a(f[2])]) >> +blank_p >> (ch_p('*') | int_p[assign_a(f[3])]) >> +blank_p >> (ch_p('*') | int_p[assign_a(f[4])]) >> +blank_p >> (ch_p('*') | int_p[assign_a(f[5])]) >> +blank_p >> (ch_p('*') | int_p[assign_a(f[6])]) >> +blank_p >> (ch_p('*') | int_p[assign_a(f[7])]) ; if (!parse(str, myrule).full){ return 1; } return 0; } Если кому интересно - backtrace в приложении. (gdb) frame 20 (gdb) print p.subj.first_.subj.first_.subj.first_.subj.first_.subj.first_.subj.first_.subj.first_.subj.first_.subj.first_.subj.first_.subj.first_.subj.first_.subj.first_.subj.first_.subj.seco nd_.subj.second_.actor { = {}, ref = @0x0} --------------CBCF7153D6AA4C5F86BAC937 Content-Type: text/plain; charset=UTF-8; name="bt.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="bt.txt" #0 ref_value_actor::operator() (val_=3D@0xffffc= e08: 1, this=3D0x5655ebc0) at /usr/include/boost/spirit/home/classic/acto= r/ref_value_actor.hpp:60 #1 attributed_action_policy::call, char const*> (val=3D@0xffffce08: 1, actor=3D...) at /usr/includ= e/boost/spirit/home/classic/core/scanner/scanner.hpp:131 #2 action_policy::do_action, int con= st, char const*> (last=3D@0xffffcefc: 0xffffcf2d " 2 3 4 5 6 7 8", first=3D= : , val=3D@0xffffce08: 1, actor=3D..., = this=3D0xffffcf00) at /usr/include/boost/spirit/home/classic/core/scanner= /scanner.hpp:162 #3 action, ref_value_actor>::parse>> (this=3D0x5655ebbc, scan=3D...) at /usr/include/= boost/spirit/home/classic/core/composite/actions.hpp:117 #4 0x565566c4 in alternative, action, ref_value_actor>>::parse>> (scan=3D= =2E.., this=3D0x5655ebb8) at /usr/include/boost/detail/compressed_pair.hp= p:385 #5 sequence, alternative, action, ref_value_actor>>>::parse>> (scan=3D..., this=3D0x5655ebb4) at /usr/include/boost/spirit/= home/classic/core/composite/sequence.hpp:61 #6 sequence, alternative, ac= tion, ref_value_actor>>>,= positive>::parse>> (scan=3D..., this=3D0x5655e= bb4) at /usr/include/boost/spirit/home/classic/core/composite/sequence.hp= p:60 #7 sequence, alternative, action, ref_value_actor>>>, positive>, alternative, action, ref_value_actor>>>::parse>> (scan=3D..., this=3D0x5655ebb4) at /usr/include/boost/spirit/ho= me/classic/core/composite/sequence.hpp:60 #8 sequence, alternati= ve, action, ref_value_actor>>>, positive>, alternative, acti= on, ref_value_actor>>>, p= ositive>::parse>> (scan=3D..., this=3D0x5655ebb= 4) at /usr/include/boost/spirit/home/classic/core/composite/sequence.hpp:= 60 #9 sequence, = alternative, action, ref_value_ac= tor>>>, positive>, alternative, action, ref_value_actor>>>, positive>, alternative, action, ref_value_actor>>>::parse>> (scan=3D..., this=3D0x5655ebb4) at /usr/include/boost/spirit/home= /classic/core/composite/sequence.hpp:60 #10 sequence, alternative, action, ref= _value_actor>>>, positive>, alternative= , action, ref_value_actor>>>, positive>, alternative, action= , ref_value_actor>>>, pos= itive>::parse>> (scan=3D..., this=3D0x5655ebb4)= at /usr/include/boost/spirit/home/classic/core/composite/sequence.hpp:60= #11 sequence, alternative, action, ref_value_actor>>>, positive>, al= ternative, action, ref_value_acto= r>>>, positive>, alternative, action, ref_value_actor>>>, positive>, alternative, action, ref_value_actor>>>::parse>> (scan=3D..., this=3D0x5655ebb4) at /usr/include/boost/spirit/home/c= lassic/core/composite/sequence.hpp:60 #12 sequence, alternative, action, ref_value_actor>>>, positive>, alternative, action, ref_v= alue_actor>>>, positive>, alternative, action, ref_value_actor>>>, positive>, alternative, action, ref_value_actor>>>, posit= ive>::parse>> (this=3D0x5655ebb4, scan=3D...) a= t /usr/include/boost/spirit/home/classic/core/composite/sequence.hpp:60 #13 0x565569c0 in sequence, alternative= , action, ref_value_actor= >>>, positive>, alternative, action, ref_value_actor>>>, positive>, alternative, action, re= f_value_actor>>>, positive>, alternativ= e, action, ref_value_actor>>>, positive>, alternative, actio= n, ref_value_actor>>>::pa= rse>> (scan=3D..., this=3D0x5655ebb4) at /usr/include/boost/d= etail/compressed_pair.hpp:382 #14 sequence, alternative, act= ion, ref_value_actor>>>, = positive>, alternative, action, ref_value_actor>>>, positive>, alternative, action, ref_val= ue_actor>>>, positive>, alternative, action, ref_value_actor>>>, positive>, alternative, action, ref_value_actor>>>, positiv= e>::parse>> (scan=3D..., this=3D0x5655ebb4) at = /usr/include/boost/spirit/home/classic/core/composite/sequence.hpp:60 #15 sequence, alternative, action, ref_value_actor>>>, positive>, alternative, action, ref_value_actor>>>, positive>, alternative, action= , ref_value_actor>>>, positive>, altern= ative, action, ref_value_actor>>>, positive>, alternative, a= ction, ref_value_actor>>>= , positive>, alternative, action, ref_value_actor>>>::parse>= > (scan=3D..., this=3D0x5655ebb4) at /usr/include/boost/spirit/home/class= ic/core/composite/sequence.hpp:60 #16 sequence, alternativ= e, action, ref_value_actor>>>, positive>, alternative, actio= n, ref_value_actor>>>, po= sitive>, alternative, action, ref_value_actor>>>, positive= >, alternative, action, ref_value= _actor>>>, positive>, alternative, action, ref_value_actor>>>, positive>, alternative, action, ref_value_actor>>>, positive<= blank_parser>>::parse>> (this=3D0x5655ebb4, scan=3D...) at /u= sr/include/boost/spirit/home/classic/core/composite/sequence.hpp:60 #17 0x56556b7f in sequence, alternative, action,= ref_value_actor>>>, positive>, alterna= tive, action, ref_value_actor>>>, positive>, alternative, ac= tion, ref_value_actor>>>,= positive>, alternative, action, ref_value_actor>>>, positive>, alternative, action, ref_va= lue_actor>>>, positive>, alternative, action, ref_value_actor>>>, positive>, alternative, action, ref_value_actor>>>::parse<= scanner>> (scan=3D..., this=3D0x5655ebb4) at /usr/include/boost/detai= l/compressed_pair.hpp:382 #18 sequence, alternative , action, ref_value_actor>>>, positive>, alternative, action= , ref_value_actor>>>, pos= itive>, alternative, action, ref_value_actor>>>, positive>= , alternative, action, ref_value_= actor>>>, positive>, alternative, action, ref_value_actor>>>, positive>, alternative, action, ref_value_actor>>>, positive>, alternative, action, ref_value_actor>>>, positive>::parse= >> (scan=3D..., this=3D0x5655ebb4) at /usr/include/boost/spir= it/home/classic/core/composite/sequence.hpp:60 #19 sequence, alternative, action, ref_value_actor>>>, positive>, alt= ernative, action, ref_value_actor= >>>, positive>, alternative= , action, ref_value_actor= >>>, positive>, alternative, action, ref_value_actor>>>, positive>, alternative, action, re= f_value_actor>>>, positive>, alternativ= e, action, ref_value_actor>>>, positive>, alternative, actio= n, ref_value_actor>>>, po= sitive>, alternative, action, ref_value_actor>>>::parse>> (s= can=3D..., this=3D0x5655ebb4) at /usr/include/boost/spirit/home/classic/c= ore/composite/sequence.hpp:60 #20 impl::concrete_parser, alternative, action, ref_value_actor>>>, positi= ve>, alternative, action, ref_value_actor>>>, positive>, a= lternative, action, ref_value_act= or>>>, positive>, alternative, action, ref_value_actor>>>, positive>, alternative, action, ref_value_actor>>>, positive>, alternative, action, = ref_value_actor>>>, positive>, alternat= ive, action, ref_value_actor>>>, positive>, alternative, act= ion, ref_value_actor>>>, = scanner>, nil_t>::do_parse_virtual (this=3D0x5655ebb0, scan=3D...) at= /usr/include/boost/spirit/home/classic/core/non_terminal/impl/rule.ipp:2= 41 #21 0x56556367 in impl::rule_base, rule const&, nil_t, nil_t, nil_t>::parse_main>> (sca= n=3D..., this=3D0xffffcef8) at /usr/include/boost/spirit/home/classic/cor= e/impl/match.ipp:66 #22 impl::rule_base, rule = const&, nil_t, nil_t, nil_t>::parse>> (scan=3D..., this=3D0xf= fffcef8) at /usr/include/boost/spirit/home/classic/core/non_terminal/impl= /rule.ipp:174 #23 parse> (p=3D..., last=3D: , first_=3D: ) at /usr/include/boost/spirit/home/classic/core/impl/parser.ipp:30 #24 parse> (p=3D..., str=3D0xffffcf2b " 1= 2 3 4 5 6 7 8") at /usr/include/boost/spirit/home/classic/core/impl/pars= er.ipp:47 #25 main () at main.cpp:18 --------------CBCF7153D6AA4C5F86BAC937--