From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [81.169.146.163]) by sourceware.org (Postfix) with ESMTPS id 18E843858294 for ; Fri, 12 Jan 2024 12:32:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 18E843858294 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gjlay.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=gjlay.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 18E843858294 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=81.169.146.163 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1705062752; cv=pass; b=TsrqUxojJegPwupCF5vk0t/KmERCTNbZURNcQ4o7j5Pt+z4z/wASp3AKiFwYh6Mw/7sOjP/vDV1A0NyUiIpI2E5tiBt3MIL2K2Cpqs4ZZ0vyb/OV6CKayLTGJhN7nhQ80MlxsxdqgcX6eioxJGqZ7Bov7WpjRWFSjIQoqQ27Rac= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1705062752; c=relaxed/simple; bh=/8eKoLgVDCz5jrOcmJOst2PVTV5np2od1daGJgUdggM=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version: Subject:To:From; b=twLUq2U3RZIuRflWFIZCKMpE1bpfg/yOv5nnVkPFUXuBW8d2F01/V6Tgu0DAbeUFjjLjIpTn8KCh8Prf0Xt+qm64JP5Q/79uLqSypNCJu0ZUemiiT3mKjv2MkQiJc5T0PqfbOD/X513oi/AIL3hTsD67bc711Y3y1dmoC6wTaFI= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; t=1705062747; cv=none; d=strato.com; s=strato-dkim-0002; b=Tr6FTKCU+zYc2WkgOz2GFyVvPbgBjd1s6UHAjngVxqvQO1PDgd2jie3CGjMsl/grt8 UzfHvHA5FvzBrRgKxBOD9LURl759e+IqTig+oDmkQEsU1xBP/N0T4h/R0AF/grmPJfdC iNKYMW6fJOIRZR4iD9Y3FDer3O11zF5/EY1vRbL5XLjaUE+PmThHAdJYVtj0H+lOWtuJ Yy7FTyW4JcBjrGmTDG8/vg5OI/bsy8KJOqccnhDh1ic1JcmkKKn/tFHffK4wOMdpdw0Z BBr6sjZcJzq+tyaTVCA4fZBqLyQUIFuPFsyD2nL/AWUW0wJSIT9rZU5bNasuDwjE12oJ zhLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1705062747; s=strato-dkim-0002; d=strato.com; h=In-Reply-To:From:References:Cc:To:Subject:Date:Message-ID:Cc:Date: From:Subject:Sender; bh=LWwelImtYkqdBhKPZtKJNsxcApGfgh+U2/0vGbLlEmc=; b=Nxonxrl5nZra/ItGHyCJMfvxOIcBvw9WmGglRApLj8TYx0pclZYPooieVH+HMu/jEG tyacQ7+Y1jbF9YIn3asqEwti9wMLWBcDZggigRIrF73+mapz4avw6Lwrnark0E/gQc5g eqXuJHbsxwX6Vv5MbGgMy//yNPXkLnq9+K4g0XTgDPbdTxwDUjAqWkLt9kfDp9WG+4FR NhNWRegwZnTQqmxrrHmfD6Pfdlxh1rK2vNDlSlAngBMj9Ll5T5DEI5Ovma0Qdj5CUrL1 ibGF7cjbk5k/0h79aF46iNia8gPRFWjpVgtZcWyJtsPucD48P6YEh6Pfh0CQVuiRUxt1 X1zQ== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1705062747; s=strato-dkim-0002; d=gjlay.de; h=In-Reply-To:From:References:Cc:To:Subject:Date:Message-ID:Cc:Date: From:Subject:Sender; bh=LWwelImtYkqdBhKPZtKJNsxcApGfgh+U2/0vGbLlEmc=; b=ja5JFTU5XnuRKEOvuClpJufB9+DXNGeNe7XFeDNb+UreqkSC4m0ShSK11jX/R3BeI3 zvR8dy536pJOPWFwcuXDLzLIVd6M3MUsd34CiEBYqyBoTLqMjVTDHV5buRmiqS8zfKKF EXdnQTze1SGGLpKXY0jyAklFUZqRaeXFiv3BOnP42KMzYV0uoGO0rMKQdF0G6zhiWgX9 PcLYSKKhXfSFQarPPC9BwiZCe2++RVTHkJAOjyJJLAcCIRgILTSanVC4NH/fwgrBsz2N +9zdPIjfXlgLaf2Kv+081/Ik9VSVjh+UK8AQXQ5wCDginEpGpeOhrI5bBy7DOMQTLwmc v6Ng== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1705062747; s=strato-dkim-0003; d=gjlay.de; h=In-Reply-To:From:References:Cc:To:Subject:Date:Message-ID:Cc:Date: From:Subject:Sender; bh=LWwelImtYkqdBhKPZtKJNsxcApGfgh+U2/0vGbLlEmc=; b=KCNE6BOy7GZDxsJ27UHVPUWPqhRSIO6gy71xuRI2OmPD0g9J6dN4/JGDNfDVXvz6w4 MaP03BApJukkewsgeIBQ== X-RZG-AUTH: ":LXoWVUeid/7A29J/hMvvT3koxZnKT7Qq0xotTetVnKkSjsSjq3WhKPVxx3mY" Received: from [192.168.2.102] by smtp.strato.de (RZmta 49.10.2 DYNA|AUTH) with ESMTPSA id g5de8600CCWRPF0 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 12 Jan 2024 13:32:27 +0100 (CET) Message-ID: Date: Fri, 12 Jan 2024 13:32:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [patch,avr,applied] PR target/112952 Fix attribute "io" et al. handling. Content-Language: en-US To: Jan-Benedict Glaw Cc: gcc-patches@gcc.gnu.org, Denis Chertykov References: <83b90302-bd7b-4064-8c8e-7495ebd3931e@gjlay.de> <20240112033702.GD2971@lug-owl.de> From: Georg-Johann Lay In-Reply-To: <20240112033702.GD2971@lug-owl.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Am 12.01.24 um 04:37 schrieb Jan-Benedict Glaw: > On Thu, 2024-01-04 17:28:02 +0100, Georg-Johann Lay wrote: >> This fixes the avr-specific attributes io, io_low and address, >> that are all basically the same except that io and io_low imply >> assertions on allowed addressing modes. > >> --- a/gcc/config/avr/avr.cc >> +++ b/gcc/config/avr/avr.cc > [...] >> @@ -10385,12 +10389,10 @@ avr_handle_addr_attribute (tree *node, tree name, tree args, >> } >> else if (io_p >> && (!tree_fits_shwi_p (arg) >> - || !(strcmp (IDENTIFIER_POINTER (name), "io_low") == 0 >> - ? low_io_address_operand : io_address_operand) >> - (GEN_INT (TREE_INT_CST_LOW (arg)), QImode))) >> + || ! IN_RANGE (TREE_INT_CST_LOW (arg), io_start, io_end))) >> { >> - warning_at (loc, OPT_Wattributes, "%qE attribute address " >> - "out of range", name); >> + warning_at (loc, OPT_Wattributes, "%qE attribute address out of " >> + "range 0x%x...0x%x", name, (int) io_start, (int) io_end); >> *no_add = true; >> } >> else > > Building with a recent GCC, this results in a new warning (here forced > to an error with --enable-werror-alway--enable-werror-always): > > /var/lib/laminar/run/gcc-avr-elf/64/local-toolchain-install/bin/g++ -fno-PIE -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common -DHAVE_CONFIG_H -fno-PIE -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace -o avr.o -MT avr.o -MMD -MP -MF ./.deps/avr.TPo ../../gcc/gcc/config/avr/avr.cc > ../../gcc/gcc/config/avr/avr.cc: In function 'tree_node* avr_handle_addr_attribute(tree_node**, tree, tree, int, bool*)': > ../../gcc/gcc/config/avr/avr.cc:10391:45: error: unquoted sequence of 3 consecutive punctuation characters '...' in format [-Werror=format-diag] > 10391 | warning_at (loc, OPT_Wattributes, "%qE attribute address out of " > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 10392 | "range 0x%x...0x%x", name, (int) io_start, (int) io_end); > | ~~~~~~~~~~~~~~~~~~~ > cc1plus: all warnings being treated as errors > make[1]: *** [Makefile:2554: avr.o] Error 1 > make[1]: Leaving directory '/var/lib/laminar/run/gcc-avr-elf/64/toolchain-build/gcc' > make: *** [Makefile:4676: all-gcc] Error 2 > > > I think this should be "%<...%>". > > MfG, JBG Hi, thanks for sorting this out. I would install the patch below. I must admit that I don't understand that warning and what is illegal about having ellipses in a format string at that place. That warning isn't even documented, at least as of 2024-02-12 https://gcc.gnu.org/onlinedocs/gcc/Option-Index.html There should be no quotes around the ellipses, they are intended as real ellipses. Plus, I saw in other modules that it warns about format strings like printf (";%i", 10); Why is ";" not allowed there? Johann -- diff --git a/gcc/config/avr/avr.cc b/gcc/config/avr/avr.cc index 0cdd035fa1a..4bc3cf929de 100644 --- a/gcc/config/avr/avr.cc +++ b/gcc/config/avr/avr.cc @@ -10388,8 +10388,8 @@ avr_handle_addr_attribute (tree *node, tree name, tree args, && (!tree_fits_shwi_p (arg) || ! IN_RANGE (TREE_INT_CST_LOW (arg), io_start, io_end))) { - warning_at (loc, OPT_Wattributes, "%qE attribute address out of " - "range 0x%x...0x%x", name, (int) io_start, (int) io_end); + warning_at (loc, OPT_Wattributes, "%qE attribute address out of range" + " 0x%x%s0x%x", name, (int) io_start, "...", (int) io_end); *no_add = true; } else