From patchwork Tue Aug 23 13:40:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janne Blomqvist X-Patchwork-Id: 661875 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sJWmx304Mz9t0w for ; Tue, 23 Aug 2016 23:41:20 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=F6TJS7ub; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=L9D9BuECOI6h/lSfhSLurGDGTshjOReXHYVNj2D9bwFHGj hXGaWXvHGGbD7f6QhpqQ7+ami/cf4iI3LefVwnuL9JG4bsS4M38TEgbdtZPBhmBO 2Zt5F/M+T0VNpZC5EqT9PqJYc3a2DlhTyP1XbBg1Lq9Ntsopa83K7lEBakI34= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=YsaC3LzeFDOyJtc8BH9cdf0PKKc=; b=F6TJS7ubRAWcv/2OjD81 S/csVzdqRvm3VB+ltNP8gODZekODKF9GRiqrK9mnVGNaHsADSVnVifqYLxG/WRMu 5YIiM9mEVpzQAk/SHrryUHGBVt1rtpE+y/gMAXslb0olzdfnF/4BQqSKRawypHjF KguImYFhnONKwfiwBzOC6Y0= Received: (qmail 9531 invoked by alias); 23 Aug 2016 13:41:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 8562 invoked by uid 89); 23 Aug 2016 13:40:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=essentially, Hx-languages-length:2448, jb@gcc.gnu.org, jbgccgnuorg X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-wm0-f52.google.com Received: from mail-wm0-f52.google.com (HELO mail-wm0-f52.google.com) (74.125.82.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 23 Aug 2016 13:40:49 +0000 Received: by mail-wm0-f52.google.com with SMTP id q128so164010452wma.1; Tue, 23 Aug 2016 06:40:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=B7wG4SfynsCJ8rcLWRUqwY+sa6iCFE7bvME9nu2DeGk=; b=f3Waxtn/+v1bFxtF6UoKIY7oodnHZeTcy2YifBvqmFhUKhJMMWrIDblGcOhJqJaHLL qSHKyzrk7t/jAS/4gXCQglfnfGpURvZWH3kjlFxYCeBEWvM0CiMd2oRMLYjh6TQVhKHU IwnxtS4ueB07rcP7sHDcdz8P2Td5PJZgL8KevlRWh6yMojJXOeApSxmqQmkCnmq2gOeM YLvk61irUfADqD+H8zO3RnMoYtaw3lBxYVH1RcikxRBVGC8CwI9FGezZk6Nr5J3mvAMR UkbYzWdAEOwR5X0VWBGbsO9pzAMtMM/5KvZfNjGG1RCb2watza3Ji2QYf4M+101LsMoC GmfA== X-Gm-Message-State: AEkoout2hsdcWLjaCwz8GU0KCLCIPJsIXAieKT/q7HKF9t+9n76IPIqIBHdJ1IMedJMhR/URSYdAi89mFw9zag== X-Received: by 10.194.176.165 with SMTP id cj5mr21892335wjc.82.1471959647001; Tue, 23 Aug 2016 06:40:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.173.40 with HTTP; Tue, 23 Aug 2016 06:40:46 -0700 (PDT) From: Janne Blomqvist Date: Tue, 23 Aug 2016 16:40:46 +0300 Message-ID: Subject: [PATCH, fortran] PR 77261 gfortran.dg/random_3.f90 failure To: Fortran List , GCC Patches Hi, the attached patch fixes PR 77261. The problem is that with the new PRNG, the random sequence for real(16) and lesser kinds is not the same. And then on targets that have real(16) but not real(10) the testcase fails. Fixed by essentially running the tests only when real(10) is available. Regtested on x86_64-pc-linux-gnu, Ok for trunk? 2016-08-23 Janne Blomqvist PR fortran/77261 * gfortran.dg/random_3.f90: Run testcase only when real(10) is available. diff --git a/gcc/testsuite/gfortran.dg/random_3.f90 b/gcc/testsuite/gfortran.dg/random_3.f90 index 8e087c4..0491000 100644 --- a/gcc/testsuite/gfortran.dg/random_3.f90 +++ b/gcc/testsuite/gfortran.dg/random_3.f90 @@ -1,10 +1,10 @@ ! { dg-do run } ! { dg-require-effective-target fortran_large_real } -! Check that the random_seed for real(10) or real(16) exists and that -! real(8) and real(10) or real(16) random number generators +! Check that the random_seed for real(10) exists and that +! real(8) and real(10) random number generators ! return the same sequence of values. ! Mostly copied from random_2.f90 -program random_4 +program random_3 integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1) integer, dimension(:), allocatable :: seed @@ -13,17 +13,23 @@ program random_4 real, parameter :: delta = 1.d-10 integer n - call random_seed (size=n) - allocate (seed(n)) - call random_seed (get=seed) - ! Test both array valued and scalar routines. - call random_number(r8) - call random_number (r8(10)) + ! Run the test only if real(10) is available. With the current + ! xorshift1024* PRNG the real(16) generator uses two uint64_t values + ! for every real(16) value generated, and hence the sequences won't + ! be the same as with real(4,8,10). + if (k == 10) then + call random_seed (size=n) + allocate (seed(n)) + call random_seed (get=seed) + ! Test both array valued and scalar routines. + call random_number(r8) + call random_number (r8(10)) - ! Reset the seed and get the real(8) values. - call random_seed (put=seed) - call random_number(r10) - call random_number (r10(10)) + ! Reset the seed and get the real(8) values. + call random_seed (put=seed) + call random_number(r10) + call random_number (r10(10)) - if (any ((r8 - r10) .gt. delta)) call abort -end program random_4 + if (any ((r8 - r10) .gt. delta)) call abort + end if +end program random_3