diff --git a/tests/usr.bin/xlint/lint1/lex_char_uchar.c b/tests/usr.bin/xlint/lint1/lex_char_uchar.c index 9c91b9bb1559..25d0fe1a096b 100644 --- a/tests/usr.bin/xlint/lint1/lex_char_uchar.c +++ b/tests/usr.bin/xlint/lint1/lex_char_uchar.c @@ -1,4 +1,4 @@ -/* $NetBSD: lex_char_uchar.c,v 1.1 2021/06/29 13:58:13 rillig Exp $ */ +/* $NetBSD: lex_char_uchar.c,v 1.2 2021/06/29 14:19:51 rillig Exp $ */ # 3 "lex_char_uchar.c" /* @@ -11,6 +11,7 @@ /* * FIXME: The warning is bogus; it must be possible to initialize a char * variable with a character constant. + * See tree.c, function convert_constant. */ /* expect+1: conversion of 'int' to 'char' is out of range [119] */ char ch = '\xff'; diff --git a/tests/usr.bin/xlint/lint1/lex_char_uchar.exp b/tests/usr.bin/xlint/lint1/lex_char_uchar.exp index 6985a5eda79f..e8e2ccfb9c6a 100644 --- a/tests/usr.bin/xlint/lint1/lex_char_uchar.exp +++ b/tests/usr.bin/xlint/lint1/lex_char_uchar.exp @@ -1 +1 @@ -lex_char_uchar.c(16): warning: conversion of 'int' to 'char' is out of range [119] +lex_char_uchar.c(17): warning: conversion of 'int' to 'char' is out of range [119] diff --git a/usr.bin/xlint/lint1/tree.c b/usr.bin/xlint/lint1/tree.c index aeb3a97e85f4..271593d4f211 100644 --- a/usr.bin/xlint/lint1/tree.c +++ b/usr.bin/xlint/lint1/tree.c @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.295 2021/06/29 10:12:35 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.296 2021/06/29 14:19:51 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.295 2021/06/29 10:12:35 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.296 2021/06/29 14:19:51 rillig Exp $"); #endif #include @@ -2410,6 +2410,11 @@ convert_constant(op_t op, int arg, const type_t *tp, val_t *nv, val_t *v) case LCOMPLEX: break; default: + /* + * FIXME: There must be no sign extension when converting + * from int to char on a platform where char == unsigned + * char. See test lex_char_uchar.c. + */ sz = tp->t_bitfield ? tp->t_flen : size_in_bits(nt); nv->v_quad = xsign(nv->v_quad, nt, sz); break;