From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id 81C2B386100E for ; Tue, 14 Jul 2020 21:15:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 81C2B386100E Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-114-vaMHCRXPN3-w8SEt6ajtfQ-1; Tue, 14 Jul 2020 17:15:05 -0400 X-MC-Unique: vaMHCRXPN3-w8SEt6ajtfQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 62A261080; Tue, 14 Jul 2020 21:15:04 +0000 (UTC) Received: from ovpn-112-142.phx2.redhat.com (ovpn-112-142.phx2.redhat.com [10.3.112.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id C737060E1C; Tue, 14 Jul 2020 21:15:03 +0000 (UTC) Message-ID: Subject: Re: [PATCH] libgccjit: Handle truncation and extension for casts [PR 95498] From: David Malcolm To: Antoni Boucher , gcc-patches@gcc.gnu.org, jit@gcc.gnu.org Date: Tue, 14 Jul 2020 17:15:03 -0400 In-Reply-To: <20200713003002.bs5hwv4gav6ml5rt@bouanto-laptop.localdomain> References: <20200713003002.bs5hwv4gav6ml5rt@bouanto-laptop.localdomain> User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: jit@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Jit mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jul 2020 21:15:11 -0000 On Sun, 2020-07-12 at 20:30 -0400, Antoni Boucher via Jit wrote: > Hello. > > As mentioned in bug 95498, some conversions do not work. After > investigation, it turns out that it's caused by multiple casts on an > expression where it should do a truncation/extension. Thanks for investigating this. > I added a testcase, but for some reasons, the tests only pass when > ran > via `./testsuite/jit/test-cast.c.exe`, not when ran via `make check- > jit > RUNTESTFLAGS="-v -v -v jit.exp=test-cast.c"`. That's weird. It sounds like you're following the instructions on https://gcc.gnu.org/onlinedocs/jit/internals/index.html#running-the-test-suite If you're not specifying LD_LIBRARY_PATH, it might be that when you run ./testsuite/jit/test-cast.c.exe directly that the version of libgccjit.so that the exe gets dynamically linked against might not be the one you expect (e.g. a distribution- provided libgccjit.so, rather than the one in your build directory). Maybe that explains the differences in behavior? (or maybe somehow "make check-jit" is using the wrong DSO???). You could try exporting LD_DEBUG=files (or somesuch) to get info on which libgccjit.so is being used in each manner of invoking the test. There are some notes at the URL above on how to run a test under gdb. If all else fails, add some printfs and look at the output from "make check-jit", and look at jit.sum and jit.log (though you don't specify how the tests fail to pass when run that way) > Furthermore, some other tests failed, but they also fail on master. Which tests are failing for you? (and for what configuration triplet?) > Also, I was under the impression that adding `STRIP_TYPE_NOPS > (t_expr);` > in `playback::context::build_cast` would be a better fix for this, > but > that doesn't fix the issue. > Am I missing something? I'm not sure yet what the best fix would be. In general I try to mimic C behavior as much as is reasonable, but off the top of my head I'm not sure what the C frontend does here. > It's my first contribution to gcc, so I'd need help for fixing the > tests > and also a confirmation that this is the best way to fix this issue. Thanks for posting the patch; I hope the above is helpful Dave