public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/103537] Using -fstack-protector-strong "without" optimization cause segmentation fault
Date: Fri, 03 Dec 2021 20:30:19 +0000	[thread overview]
Message-ID: <bug-103537-4-nJUo5Zpm7W@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103537-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103537

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2021-12-03

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Hedayat Vatankhah from comment #2)
> With these options, the code runs a bit more but still crashes.

Right those options are supposed to be used to catch issues in your code.

> The output
> of each option is given below:
> 
> Output with -fsanitize=undefined:
> /home/hedayat/Projects/powerfake/powerfake.h:257:40: runtime error: load of
> misaligned address 0x00000044c556 for type '<unknown> *', which requires 8
> byte alignment
> 0x00000044c556: note: pointer points here
>  00 e8 ac 5a 00 00  84 c0 74 17 48 8d 55 f4  48 8d 45 f8 48 89 c6 bf  00 5c
> 4b 00 e8 17 5b 00  00 eb
>              ^ 
> zsh: segmentation fault (core dumped)  ./sample/samples

Can you check the above part of the problem.



template <typename FuncType>
remove_func_cv_t<FuncType> unify_pmf(FuncType f)
{
    return reinterpret_cast<remove_func_cv_t<FuncType>>(f);
}


This looks like it could cause issues.
So does:

            return std::make_pair(reinterpret_cast<void *>(func_ptr),
                std::type_index(typeid(FuncType)));


I get the feeling you don't understand how pointer to member functions work in
some cases.

  parent reply	other threads:[~2021-12-03 20:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03  9:11 [Bug c++/103537] New: " hedayat.fwd at gmail dot com
2021-12-03  9:16 ` [Bug middle-end/103537] " pinskia at gcc dot gnu.org
2021-12-03 20:15 ` hedayat.fwd at gmail dot com
2021-12-03 20:30 ` pinskia at gcc dot gnu.org [this message]
2021-12-04 23:04 ` hedayat.fwd at gmail dot com
2021-12-04 23:17 ` hedayat.fwd at gmail dot com
2021-12-04 23:37 ` hedayat.fwd at gmail dot com
2021-12-05  0:19 ` hedayat.fwd at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-103537-4-nJUo5Zpm7W@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).