[Bug tree-optimization/60770] disappearing clobbers

2021-01-27 Thread orgads at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60770

Orgad Shaneh  changed:

   What|Removed |Added

 CC||orgads at gmail dot com

--- Comment #13 from Orgad Shaneh  ---
The case described in comment 1 doesn't issue a warning with GCC 10.

Looks like it's a different case than bug 60517.

[Bug tree-optimization/60770] disappearing clobbers

2021-01-27 Thread orgads at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60770

--- Comment #15 from Orgad Shaneh  ---
test.cpp: In function ‘int f(int)’:
test.cpp:7:11: warning: ‘q’ is used uninitialized in this function
[-Wuninitialized]
7 |   return *p;
  |   ^

Is this the intended description? It doesn't refer to the real problem (storing
a pointer to a variable that is out of scope).

[Bug ipa/120345] array subscript is partly outside array bounds

2025-05-20 Thread orgads at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120345

--- Comment #3 from Orgad Shaneh  ---
Looks right. See analysis in
https://github.com/scummvm/scummvm/pull/6620#issuecomment-2886321894

[Bug c++/120345] New: array subscript is partly outside array bounds

2025-05-19 Thread orgads at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120345

Bug ID: 120345
   Summary: array subscript is partly outside array bounds
   Product: gcc
   Version: 12.5.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: orgads at gmail dot com
  Target Milestone: ---

This is the most minimal repro I could create:

struct List {
void *f1 = nullptr;
void *f2 = nullptr;
};

class Base {
public:
virtual ~Base() {}
virtual void foo() = 0;
};

class Derived1 : public Base {
char buf[10];

public:
Derived1() {}
~Derived1() override {}
void foo() override;
};

class Derived2 : public Base {
public:
Derived2();
~Derived2();
void foo() override;
};

void test()
{
Base *update = new Derived2();
List list;
delete update;
}

When compiling with -fcheck-new -Wall -O2, the following error is shown:

In destructor 'virtual Derived1::~Derived1()',
inlined from 'virtual Derived1::~Derived1()' at :17:24,
inlined from 'void test()' at :32:9:
:17:31: warning: array subscript 'Derived1::__as_base [0]' is partly
outside array bounds of 'unsigned char [8]' [-Warray-bounds=]
   17 | ~Derived1() override {}
  |   ^
: In function 'void test()':
:30:37: note: object of size 8 allocated by 'operator new'
   30 | Base *update = new Derived2();
  |

This looks similar to bug 106247 and some others.

Godbolt link: https://godbolt.org/z/Pa8xh5T5n