public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/90216] Stack Pointer decrementing even when not loading extra data to stack.
       [not found] <bug-90216-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-16  1:14 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: pinskia at gcc dot gnu.org @ 2021-08-16  1:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Testcase:
#include <cstdint>

template<typename N, typename DataType>
struct Neighbourhood {
    using datatype = DataType;
};


template<typename B, typename N>
struct Building {
    using datatype = typename N::datatype;

    operator datatype() const{
        return (static_cast<B const *>(this)->contam_level);
    }
    void operator=(datatype const x) volatile {
        static_cast<B volatile*>(this)->contam_level = x;
    }
};

struct Cincin : public Neighbourhood<Cincin, uint32_t>
{
    struct Apartment : Building<Apartment, Cincin>{ 

        using Building<Apartment, Cincin>::operator=;
        Apartment(Apartment volatile & a) : contam_level(a.contam_level) {}
        Apartment(uint32_t const c = 0) : contam_level (c) {}

        union {
            struct
            {
                uint32_t laundry                       :3;
                uint32_t                               :5;
                uint32_t lobby                         :8;
                uint32_t                               :16;
            };
            uint32_t contam_level;
        };

        Apartment& Laundry(uint32_t val){
            this->laundry = val;
            return *this;
        }
    };
    Apartment volatile apartment;
};

Cincin cincin[2];


int main(){

  cincin[0].apartment = Cincin::Apartment().Laundry(0x7);
  //cincin[0].apartment = Cincin::Apartment(0x7);
  //cincin[0].apartment = 9;
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-16  1:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-90216-4@http.gcc.gnu.org/bugzilla/>
2021-08-16  1:14 ` [Bug middle-end/90216] Stack Pointer decrementing even when not loading extra data to stack pinskia at gcc dot gnu.org

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).