Skip to content

[TBAA][DSE] bitfield store is incorrectly optimized out #82586

Closed
@dtcxzyw

Description

@dtcxzyw

Reproducer: https://godbolt.org/z/jKrGW5jEh

#include <stdint.h>

struct S1 {
   signed f0 : 9;
   unsigned f1 : 2;
   int8_t  f2;
};

struct S1 g;

struct S1 func(struct S1* x) {
    x->f2 = 3;
    *x = g;
    return *x;
}

x->f2 = 3 is incorrectly eliminated by DSEPass.
This miscompilation is caused by recent commit #81313.

Metadata

Metadata

Labels

TBAAType-Based Alias Analysis / Strict Aliasingmiscompilation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions