[PATCH] D142535: [DAGCombine] Fold redundant select
Asmaa via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 24 11:03:58 PST 2023
asmok-g added a comment.
Thank you for reverting and sorry for late reply.
In case it was still needed, here's a repro for the miscompile:
#include <stdint.h>
typedef enum {
G_UNICODE_BREAK_ZERO_WIDTH_SPACE,
G_UNICODE_BREAK_ALPHABETIC,
G_UNICODE_BREAK_NEXT_LINE,
G_UNICODE_BREAK_WORD_JOINER
} GUnicodeBreakType;
int8_t break_property_data[][1]{G_UNICODE_BREAK_ALPHABETIC};
typedef enum { BREAK_PROHIBITED, BREAK_ALLOWED } BreakOpportunity;
char utf8_skip_data[]{};
char *g_utf8_skip = utf8_skip_data;
#define g_utf8_next_char(p) p + g_utf8_skip[*p]
#define TPROP_PART1(Page, Char) break_property_data[Page][Char]
#define PROP(Char) (5 ? TPROP_PART1(0, Char) : 0)
GUnicodeBreakType g_unichar_break_type(int c) {
return (GUnicodeBreakType)PROP(c);
}
struct _PangoLogAttr {
unsigned is_line_break;
};
int pango_default_break_i, pango_default_break_done;
GUnicodeBreakType pango_default_break_prev_break_type;
void pango_default_break(char *text, _PangoLogAttr *attrs) {
char *next;
uint32_t next_wc, almost_done;
GUnicodeBreakType next_break_type;
next = text;
for (; !pango_default_break_done; pango_default_break_i++) {
BreakOpportunity break_op;
if (almost_done)
pango_default_break_done = !0;
next = g_utf8_next_char(next);
if (*next)
almost_done = next_break_type = g_unichar_break_type(next_wc);
attrs[pango_default_break_i].is_line_break = !0;
if (pango_default_break_prev_break_type == G_UNICODE_BREAK_WORD_JOINER ||
next_break_type == G_UNICODE_BREAK_WORD_JOINER)
break_op = BREAK_PROHIBITED;
if (pango_default_break_prev_break_type)
break_op = BREAK_PROHIBITED;
if (pango_default_break_prev_break_type == G_UNICODE_BREAK_NEXT_LINE)
break_op = BREAK_ALLOWED;
switch (break_op)
case BREAK_PROHIBITED:
attrs[pango_default_break_i].is_line_break = 0;
pango_default_break_prev_break_type = next_break_type;
}
}
int main() {
_PangoLogAttr logs[7];
pango_default_break("ગોંડલનું મોવિયા અને દેરડીકુંભાજી ગામ સજ્જડ બંધ", &logs[0]);
int ret = logs[1].is_line_break << 1;
return ret;
}
reproducing command is
$ clang -O1 -fsanitize=address break.cc -o break
returns 0 before patch and 2 after.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142535/new/
https://reviews.llvm.org/D142535
More information about the llvm-commits
mailing list