Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-25562

Struct size tooltips are incorrect for x86-64

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Done
    • Affects Version/s: Qt Creator 4.15.0-beta2
    • Fix Version/s: Qt Creator 5.0.0-beta1
    • Component/s: C/C++/Obj-C++ Support
    • Labels:
      None
    • Environment:
      Kubuntu 20.10 x86-64
    • Platform/s:
      Linux/X11

      Description

      QtCreator displays structure sizes in tooltips when you hover mouse over the structure name in the structure definition. Those sizes are incorrect in a few contexts.

      For example, in these definitions:

      #include <cstdint>
      
      struct A
      {
      	std::uint64_t a;
      	std::uint8_t b;
      };
      
      struct B :
      	public A
      {
      	std::uint8_t c;
      };
      

      hovering mouse over A shows its size is 12 bytes, and B is 16 bytes. gcc shows 16 and 24, respectively (https://gcc.godbolt.org/z/YzGf5EeGn).

      Another example:

      #include <cstdint>
      
      struct A
      {
      	std::uint8_t b;
      
      	virtual ~A();
      };
      
      struct B :
      	public A
      {
      	std::uint8_t c;
      };
      

      Here QtCreator shows 8 bytes for each struct while gcc shows 16 (https://gcc.godbolt.org/z/Wvnz6xd6f).

      It looks like the struct sizes are calculated for 32-bit x86 target, even though the actual build target is x86-64.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            kandeler Christian Kandeler
            Reporter:
            lastique Andrey Semashev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes